Intro
Because I couldn't find a clear overview of which properties are availabe in maven2 I started this page. It is a collection of things found in the offcial maven documentation and postings to the maven user mailing list.
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.
outputD
irectory
}
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: or${pom.version
}). -
${project.build.finalName
} refers to the final name of the file created when the built project is packaged
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 inhello
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()
.
Comments
Here is my list. Some of these are not yet on the list and some of them are already are. And I must admit that I am still not yet acquainted with some of them.
I also placed here where I got these from just in case somebody wants to know how I came up with this list and where to get more info (code-reading-wise).
Not sure though if this is the complete list (excluding plugin expressions and user-defined properties).
* project (from [1])
o project.distributionManagementArtifactRepository
o project.artifact
o project.parent
o project.file
o project.artifacts
o project.parentArtifact
o project.pluginArtifacts
o project.remoteArtifactRepositories
o project.pluginArtifactRepositories
o project.attachedArtifact
* settings (from [2])
o settings.offilne
o settings.interactive
* rootless (from [3])
o localRepository
o reactorProjects
* java properties (from [4])
o java.version
o java.vendor
o java.vendor.url
o java.home
o java.vm.specification.version
o java.vm.specification.vendor
o java.vm.specification.name
o java.vm.version
o java.vm.vendor
o java.vm.name
o java.specification.version
o java.specification.vendor
o java.specification.name
o java.class.version
o java.class.path
o java.library.path
o java.io.tmpdir
o java.compiler
o java.ext.dirs
o os.name
o os.arch
o os.version
o file.separator
o path.separator
o line.separator
o user.name
o user.home
o user.dir
摘自:http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
相关推荐
maven 配置环境变量,需要从官网下载本地程序包,设置电脑的环境变量,开发java project 项目使用maven 仓库,本地maven仓库
JDK和maven的环境变量配置,有图有真相
Maven的配置及使用,Maven的配置及使用Maven的配置及使用Maven的配置及使用Maven的配置及使用Maven的配置及使用Maven的配置及使用
Maven配置文件Maven配置文件
WINDOWS 10 一键配置MAVEN 环境变量.抛砖引玉吧,我的代码是根据JAVA一键配置环境变量改编而来的。如有不足之处希望大神们指点。
maven环境变量配置教程
maven配置文件配置国内阿里云镜像
maven配置阿里云镜像仓库,maven配置阿里云镜像仓库,maven配置阿里云镜像仓库。
自用maven-3.8.4,内含maven配置环境变量保姆级教程.doc
File 转 MultipartFile 和需要的maven配置File 转 MultipartFile 和需要的maven配置File 转 MultipartFile 和需要的maven配置
maven 安装 环境变量配置 步骤简单清晰 一看就会 不用烦恼
5. 配置 STS-3.3.0.RELEASE中的maven环境 2 6. 创建MAVEN项目 4 7. 配置项目pom.xml 6 8. 编译打包maven项目 9 9. MAVEN 查找类库: 10 10. MAVEN本地jar包初始化 11 11、MAVEN安装到私服(依赖于Maven Nexus配置)...
2.修改maven中conf/setting.xml的配置修改仓库位置、以及 配置server 如 <localRepository>D:\Program Files\apache-maven-3.3.3\repository <id>tomcat7 <username>admin <password>admin 3.配置jdk环境...
该jar包功能,可以在一个properties文件里面定义jdbc.url=${url},在另一个properties文件定义具体的值,通过该jar可以获取到哪个具体的值。下载之后,自行安装到本地...具体pom.xml配置使用可以参考网络其他博文,谢谢
标准maven标签功能翻译
maven的下载配置和基本使用
在cto上买的javaee全套课程 这个是maven配置与使用的笔记
1、添加了阿里云maven和spring、google、spring-plugin、apache等的国内源 2、有关配置使用Jetbrain IDEA内置Maven的环境变量的教程。
包含maven安装包、电脑环境变量步骤、eclipse配置maven步骤
maven阿里云配置文件,采用maven3.5.2,是一个非常实用的配置文件。