Maven Predefined Properties
发表于2017-07-202019-01-01 作者 wind
List of predefined Maven properties
This list is based on a wiki page from Codehaus (http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide) which unfortunately has been gone with the shutdown of Codehaus
Note: In Maven 3.0, all pom.* properties are deprecated. Use project.* instead!
Built-in properties
{basedir} represents the directory containing pom.xml{version} equivalent to {project.version} (deprecated: {pom.version})
Pom/Project properties
All elements in the pom.xml, can be referenced with the project. prefix. This list is just an example of some commonly used elements. (deprecated: {pom.} prefix){project.build.directory} results in the path to your “target” directory, this is the same as {pom.project.build.directory}{project.build.outputDirectory} results in the path to your “target/classes” directory {project.name} refers to the name of the project (deprecated: {pom.name} ). {project.version} refers to the version of the project (deprecated: {pom.version}).
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 system properties
All Java System Properties defined by the JVM: {file.separator}{java.class.path} {java.home}{java.vendor} {java.vendor.url}{java.version} {line.separator}{os.arch} {os.name}{os.version} {path.separator}{user.dir} {user.home}{user.name} …
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:
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().
相关文章
- 【技术种草】cdn+轻量服务器+hugo=让博客“云原生”一下
- CLB运维&运营最佳实践 ---访问日志大洞察
- vnc方式登陆服务器
- 轻松学排序算法:眼睛直观感受几种常用排序算法
- 十二个经典的大数据项目
- 为什么使用 CDN 内容分发网络?
- 大数据——大数据默认端口号列表
- Weld 1.1.5.Final,JSR-299 的框架
- JavaFX 2012:彻底开源
- 提升as3程序性能的十大要点
- 通过凸面几何学进行独立于边际的在线多类学习
- 利用行动影响的规律性和部分已知的模型进行离线强化学习
- ModelLight:基于模型的交通信号控制的元强化学习
- 浅谈Visual Source Safe项目分支
- 基于先验知识的递归卡尔曼滤波的代理人联合状态和输入估计
- 结合网络结构和非线性恢复来提高声誉评估的性能
- 最佳实践丨云开发CloudBase多环境管理实践
- TimeVAE:用于生成多变量时间序列的变异自动编码器
- 具有线性阈值激活的神经网络:结构和算法
- 内网渗透之横向移动 -- 从域外向域内进行密码喷洒攻击