《Maven实战》笔记 6.1 – Properties

pom.xml 里可以自定义Property,然后通过${}来引用它

<properties>
    <spring.version>2.5.6</spring.version>
</properties>
...
  <dependency>
    <artifactId>spring-core</artifactId>
    <version>${spring.version}</version>
  </dependency>

实际上,maven支持6大类property

1.上面说所的自定义属性

2.Maven内置属性,如${basedir}表示项目根目录

3.POM属性,如${project.artifactId}, ${project.build.sourceDirectory}

4.Settings属性,如${settings.localRepository}

5.Java系统属性,如${user.home}

6.环境变量属性,如${env.JAVA_HOME}

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.