1

i m using a mac and saw this error in one of my pom file. i googled around and added the following section to the pom.xml:

<profiles>
    <profile>
      <id>osx</id>
      <activation>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <properties>
        <toolsjar>${java.home}/../Classes/classes.jar</toolsjar>
      </properties>
    </profile>
  </profiles>

...
 <dependency>
   <groupId>com.sun</groupId>
   <artifactId>tools</artifactId>
   <version>1.6.0</version>
   <scope>system</scope>
   <systemPath>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar</systemPath>
 </dependency>
    ...

then when i ran

mvn clean install -Posx

i still got the same error. please help!

user468587
  • 4,799
  • 24
  • 67
  • 124
  • You should not be getting this error on Mac. See [this discussion](http://mail-archives.apache.org/mod_mbox/maven-users/201204.mbox/%3CCALhtWke7270WPLUPnRFd0KK01JfMq+W2ShHsdbFiSGRm=4aUiw@mail.gmail.com%3E). Can you check if your pom has any existing reference to `tools.jar`? – Raghuram Aug 22 '12 at 03:36
  • In your question you reference to the artifact sun.jdk:tools:jar:1.6.0:system, but you added a dependency for com.sun:tools:1.6.0. Is that correct? – kothvandir Aug 22 '12 at 16:06

1 Answers1

2

Use the below command to install tools.jar from your installed JDK location to maven repository.

$mvn install:install-file -DgroupId=sun.jdk -DartifactId=tools -Dpackaging=jar -Dversion=1.6 -Dfile="C:\Program Files\Java\jdk1.6.0_27\lib\tools.jar"

Note: Make sure that JDK installed path correct in the above command.

Paramesh Korrakuti
  • 1,997
  • 4
  • 27
  • 39