`
juncke
  • 浏览: 10154 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Maven variables

阅读更多

Maven中的内置变量

注:只是记录,方便查阅。

Build

  • ${version } 版本
  • ${basedir } 项目根目录(包含pom.xml文件的目录)

 

Project

  • ${project.build.directory } results in the path to your "target" dir, this is the same as ${pom.project.build.directory }
  • ${project.build. outputD irectory } results in the path to your "target/classes" dir
  • ${project.name } or ${pom.name } refers to the name of the project.
  • ${project.version } or ${pom.version } refers to the version of the project.
  • ${project.build.finalName } refers to the final name of the file created when the built project is packaged
  • ${project.packaging}package type, eg:jar, war

 

Local user settings

Similarly, values in the user's settings.xml can be referenced using property names with settings. prefix.

  • ${settings.localRepository } refers to the path of the user's local repository

Environment variables

Environment variables can be referenced using the env prefix

  • ${env.M2_HOME } returns the Maven2 installation path.
  • ${java.home } specifies the path to the current JRE_HOME environment use with relative paths to get for example:
    <jvm>${java.home}../bin/java.exe</jvm>

Java system properties

All Java System Properties defined by the JVM.

 

Custom properties in the POM

User defined properties in the pom.xml.

<project>
...
   <properties>
      <my.filter.value>hello</my.filter.value>
   </properties>
...
</project>
  • ${my.filter.value } will result in hello if you inserted the above XML fragment in your pom.xml

Parent Project variables

How can parent project variables be accessed?

You can use the prefix: ${project.parent }.

A good way to determine possible variables is to have a look directly at the API. I'm currently using Maven 2.2.1, and to access the Parent you can use ${project.parent }. This will return an org.apache.maven.project.MavenProject instance.

To access the parent version: ${parent.version }.

Reflection Properties

The pattern ${someX.someY.someZ } can simply sometimes mean getSomeX().getSomeY().getSomeZ() . Thus, properties such as ${project.build.directory } is translated to getProject().getBuild().getDirectory() .

分享到:
评论

相关推荐

    pom:Go中的Maven POM解析器

    用Go编写的Maven POM解析器,支持递归变量扩展/解释。 图书馆 pom.xml : ${p1}.${a.b}.z &lt; p1&gt;x${p.b} &lt; p&gt;x model , err := Unmarshal ([] byte ( data )) // supply additional variables model . ...

    Appium_Maven_Framework:具有自动生成报告的Appium Maven Framework

    2. MAVEN_HOME should already set in system variables. 脚步: 1. Open cmd and run following commands: 2. cd projectPath 3. mvn clean 4. mvn test 报告: 使用的报告: 1. Extent Report 如何创建虚拟设备...

    12306ngweb-master

    window &gt;&gt; preferences &gt;&gt; Java &gt;&gt; Build Path &gt;&gt; Classpath Variables 新建一个 M2_REPO 的变量,变量值指向你系统的Maven2的数据仓库位置 或者直接安装eclipse的maven插件,然后设置你的M2_REPO。 管理平台还需要...

    deeplearning4j examples

    (3)配置环境变量:将maven中的bin的路径添加到system variables的PATH中 (4)测试maven是否安装成功 在命令行中输入mvn -version 如果如下下图所示结果,证明配置正确 3. 下载dl4j的examples,网址为: ...

    appfuse.tar.gz

    Variables page. Add a new one with a name of M2_REPO and Path of to your local Maven repository (/Users/${username}/.m2/repository on OS X and C:\Documents and Settings\${username}\.m2\repository on...

    xmljava系统源码-fin-expr:Java的表达式计算器。专注精准,可用于金融系统

    variables) FinExpr: 一个表达式计算工具(支持添加自定义函数和变量) Brief introduction FinExpr is an expression evaluator implemented by Java. Focus on precision, can be used in financial system. ...

    java俄罗斯方块源码-Tetris-Group-Project:Java中的俄罗斯方块项目

    Variables 。 如果您还没有JAVA_HOME环境变量,则: 按New... 在Variable Name段中输入JAVA_HOME 。 按Browse Directory...并选择 JDK 的目录。 按OK 双击Path变量。 将 Maven 添加到您的路径中: 单击Browse... ...

    Learning Spark

    This edition includes new information on Spark SQL, Spark Streaming, setup, and Maven coordinates. Written by the developers of Spark, this book will have data scientists and engineers up and ...

    javeando:带有 Java 字体的存储库,包含语言培训挑战

    还请记住,如果您还没有它,请在您的 eclipse 中设置 M2_REPO 变量,在 eclipse 中通过转到 Window -&gt; Preferences - Classpath Variables 并使用名为 M2_REPO 的变量添加您的 maven 存储库的路径来执行此操作。...

    实验动物房管理管理员和职工完成日常工作事务.zip

    Project Framework:Maven-based Spring+SpringMVC+MyBatis Development Environment:IntelliJ IDEA Ultimate Subversion Tool:TortoiseSVN mounted on IDEA Front-end Framework: Layui Database:MYSQL 5.7.17 ...

    continuous-gitlab

    连续gitlab 使用docker-compose up在一个网络中启动本地GitLab实例和GitLab-runner。 ... 在GitLab &gt; $group_name &gt; Settings &gt; CI... 另请参见continuous-gitlab-repos/simple-maven-dep存储库克隆GitLab_pwd:rettnera

    java源码生成-srcgen4j-commons:Java的源代码生成(通用)

    当前有一个Maven插件(),可在构建期间或手动执行管道。 Eclipse插件已在计划中,但尚不可用。 ()项目中有一些可用的预定义解析器和生成器。 变数 变量部分允许定义全局可见变量。 &lt; variables &gt; &lt; ...

    ScoreboardStats:Bukkit插件,用于自定义Minecraft计分板功能的侧边栏

    ScoreboardStats使用Maven 3来管理建筑配置,常规项目详细信息和依赖项。 您可以使用Maven自己编译该项目。 只需从导入项目。 您的IDE将检测到Maven项目。 如果不是:从下载它。您将在bin文件夹中找到可执行文件。...

    GitHubActionTest

    您可能需要自定义应用程序名称,也可能要自定义资源组名称:为此,请编辑terraform/variables.tf 。 若要创建您的Azure资源,请安装Terraform并运行它: cd terraform terraform init terraform apply cd .. 要...

    serverless-content-service:AWS上的示例无服务器应用程序

    该应用程序通过S3存储桶上的maven程序集插件作为lambda部署为压缩的类目录,并通过API端点触发当地发展请为您的IDE安装Lombok插件,然后您需要添加以下内容进行调试或启动: VM options: -Dspring.profiles.active=...

    FihocaLiferay

    -configurar variables de entorno Path, java_home y java_home_compile_8 -descargar e instalar maven (instalar en archivos de programa) -configurar variable de entorno Path para maven -Instalar git en ...

    MandelbrotViewer:Mandelbrot集的OpenGL GPU渲染以及Java中的64位缩放

    Mandelbrot查看器Mandelbrot Viewer是一个简单的应用程序,它通过OpenGL利用GPU实时... The variables it modifies are the uniform variables u_Colorand u_maxIter used in the fragment shader below.更有用的配置变

    rules_build_secrets:Bazel构建规则,可以更轻松地将机密信息纳入构建过程

    在许多现有的构建环境中,构建过程需要访问受密码凭据保护的资源:私有docker仓库,私有maven仓库,云提供商API密钥等。应该有一种方法可以轻松,安全地通过Bazel加载和使用这些值。 此规则可帮助您将构建环境中...

    thymeleaf-extras-springsecurity-3.0-master.zip

    As with normal Spring EL expressions, Thymeleaf allows you to access a series of objects from them including the context variables map (the #vars object). In fact, you are allowed to surround your ...

    Mahout in Action

    Java and IDEs 7 ■ Installing Maven 8 ■ Installing Mahout 8 ■ Installing Hadoop 9 1.5 Summary 9 PART 1 RECOMMENDATIONS...........................................11 2 Introducing recommenders 13 2.1 ...

Global site tag (gtag.js) - Google Analytics