Maven属性前缀"用户"和" maven"有特殊意义吗?

时间:2017-07-31 17:35:13

标签: java maven

Maven POM reference表示有五种不同的风格"对于maven属性:

 env.X: Prefixing a variable with "env." will return the shell's environment 
    variable. For example, ${env.PATH} contains the PATH environment variable.

 project.x: A dot (.) notated path in the POM will contain the corresponding 
    element's value. For example: <project><version>1.0</version></project> 
    is accessible via ${project.version}.

 settings.x: A dot (.) notated path in the settings.xml will contain the 
    corresponding element's value. For example: <settings>
    <offline>false</offline></settings> is accessible via 
    ${settings.offline}.

 Java System Properties: All properties accessible via 
    java.lang.System.getProperties() are available as POM properties, such 
    as ${java.home}.

 x: Set within a <properties /> element in the POM. The value of < 
    <properties><someVar>value</someVar></properties> may be used as 
    ${someVar}. 

但是,我在命令行中设置了-Dmaven.test.skip=true等属性,而在各种maven项目中使用了user.home等其他属性。我认为前者是通过maven插件设置的(不是POM本身的一部分?),并且不知道后者。

1 个答案:

答案 0 :(得分:1)

user.home是Java系统属性,有关所有可用选项,请参阅mvn help:system

maven.test.skip是由Maven Surefire Plugin定义的参数。 maven.test - 部分是控制必须跳过哪个插件的最佳实践。 如果可以通过命令行设置maven-plugin的参数,则必须使用先前文档中调用的(User)属性或表达式。如果没有这样的密钥,则无法通过命令行设置,而只能在pom.xml

内设置