1

I am using a maven plugin that requires a class that is contained in the jdk's (windows) tools.jar (mac it's in classes.jar).

I add this as an explicit dependency of the plugin as follows:

<dependencies>
   <dependency>
     <groupId>sun.jdk</groupId>
     <artifactId>classes</artifactId>
     <version>1.6.0</version>
     <scope>system</scope>
     <systemPath>${java.home}/../Classes/classes.jar</systemPath>
   </dependency>
</dependencies>

This works if I'm using OS X. However, it does not work if I'm developing on a Windows machine. Moreover, I dislike the use of ../Classes.

Is there perhaps a better way to load in the JDK provided classes?

note: I understand the default (Sun, now Oracle) is to ship the JDK with these classes in lib/tools.jar and that the only real outlier is those who develop using the repackaged Apple JDK. Be that as it may, I am still interested in a -system independent approach- that does not depend so much on the specific path.

Jon Lorusso
  • 458
  • 1
  • 7
  • 19

2 Answers2

0

It will be interesting how to deal with it in git, because I share .idea dir.

Alex Shwarc
  • 822
  • 10
  • 20
0

You can achieve this by defining different build profiles for Windows VS Mac OS. See here for more details. http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Prabhjot
  • 695
  • 3
  • 8
  • 21