maven 使用时 帮助

maven的变量

maven定义了很多变量属性,参考这里 http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide


  1. 内置属性
    • ${basedir } represents the directory containing pom.xml
    • ${version } equivalent to ${project.version } or ${pom.version }
  2. Pom/Project properties
    所有pom中的元素都可以用 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 } refers to the name of the project.
    • ${project.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
  3. 本地用户设定
    所有用的的 settings.xml 中的设定都可以通过 settings. 前缀进行引用
    • ${settings.localRepository } refers to the path of the user's local repository.
    • ${maven.repo.local } also works for backward compatibility with maven1 ??
  4. 环境变量
    系统的环境变量通过 env. 前缀引用
    • ${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>
  5. java系统属性
    所有JVM中定义的java系统属性.
  6. 用户在pom中定义的自定义属性
    <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
  7. 上级工程的变量
    上级工程的pom中的变量用前缀 ${project.parent } 引用. 上级工程的版本也可以这样引用: ${parent.version }.


你可能感兴趣的:(maven 使用时 帮助)