- <dependency>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- <version>1.5.0</version>
- <scope>system</scope>
- <systemPath>${java.home}/lib/tools.jar</systemPath>
- </dependency>
- -vm
- D:\Program Files\Java\jdk1.6.0_23\bin\javaw.exe
- -vmargs
- -Dosgi.requiredJavaVersion=1.6
- -Xms40m
- -Xmx512m
- -XX:PermSize=64M
- -XX:MaxPermSize=512M
- <properties>
- <project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
- <java.home>C:\Program Files\Java\jdk1.6.0_25</java.home>
- </properties>
- <profiles>
- <profile>
- <id>default-tools.jar</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- <property>
- <name>java.vendor</name>
- <value>Sun Microsystems Inc.</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- <version>1.5.0</version>
- <scope>system</scope>
- <systemPath>${java.home}/lib/tools.jar</systemPath>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
通过profile来设置,方便决定是否启用
解决方案三:
- <dependency>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- <version>1.6.0</version>
- <scope>system</scope>
- <systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
- <optional>true</optional>
- </dependency>
直接使用Maven获取系统的环境变量