欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

maven之settings.xml自定义变量

程序员文章站 2022-07-13 17:14:03
...

settings.xml自定义变量:

<profile>
  <id>custom-compiler</id>
  <properties>
    <JAVA_HOME>C:\Program Files (x86)\Java\jdk1.8.0_73</JAVA_HOME>
  </properties>
</profile>

<!--当然这里应该需要**,所以settings.xml文件还应该有如下配置:-->
<activeProfiles>
    <activeProfile>custom-compiler</activeProfile>
</activeProfiles>

pom.xml即可使用该变量:

<dependency>
  <groupId>jdk.tools</groupId>
  <artifactId>jdk.tools</artifactId>
  <version>1.8</version>
  <scope>system</scope>
  <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>