Skip to content

Instantly share code, notes, and snippets.

@pfmiles
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pfmiles/7ff117e23daca6208b88 to your computer and use it in GitHub Desktop.
Save pfmiles/7ff117e23daca6208b88 to your computer and use it in GitHub Desktop.
不同操作系统下通过系统路径引入tools.jar的maven配置
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.pfmiles</groupId>
<artifactId>kan-java</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<name>kan-java</name>
<url>https://github.com/pfmiles/kan-java</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<profiles>
<profile>
<id>use-standard-tool-jar</id>
<activation>
<file>
<exists>${java.home}/../lib/tools.jar</exists>
</file>
</activation>
<properties>
<tools-jar-path>${java.home}/../lib/tools.jar</tools-jar-path>
</properties>
</profile>
<profile>
<!-- Only for mac brewed jdk, tool.jar is put at ${java.home}/../Classes/classes.jar. -->
<id>tool-jar-use-classes-jar</id>
<activation>
<file>
<exists>${java.home}/../Classes/classes.jar</exists>
</file>
</activation>
<properties>
<tools-jar-path>${java.home}/../Classes/classes.jar</tools-jar-path>
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systemPath>${tools-jar-path}</systemPath>
</dependency>
</dependencies>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment