0

I'm attempting to include C:/Java/jdk1.7.0_71/lib/tools.jar as a dependency in my .pom. Environment is Eclipse Luna SR2, Windows 10, and JAVA_HOME is defined as "C:/Java/jdk1.7.0_71".

How do I determine what version this tools.jar file "is"? Eclipse Maven editor shows an error where the dependency is defined, as "Missing artifact com.sun:tools:jar:1.7".

The dependency and profile are defined as:

<dependencies>
    <dependency>
        <groupId>com.sun</groupId>
        <artifactId>tools</artifactId>
        <version>1.7</version>
        <scope>system</scope>
        <systemPath>${tools.jar}</systemPath>
    </dependency>
</dependencies>

<profiles>
    <profile>
        <id>standard-jdk</id>
        <activation>
            <activeByDefault>false</activeByDefault>
            <file>
                <exists>${java.home}/../lib/tools.jar</exists>
            </file>
        </activation>
        <properties>
            <tools-jar>${java.home}/../lib/tools.jar</tools-jar>
        </properties>
    </profile>
</profiles>

mvn help:active-profiles shows that this profile, standard-sdk, is active, because ${java.home}/../lib/tools.jar resolves to C:/Java/jdk1.7.0_71/lib/tools.jar, and the file does exist there.

I ran mvn install, and found %userprofile%.m2/repository/com/sun/tools/ with 2 files, tools-1.7.pom.lastUpdated and tools-1.7.jar.lastUpdated in the local filesystem. Compile seems to work as expected, and the build runs to successful completion.

I've tried various version numbers from 1.7 down through 1.4, and even tried the version shown in tools.jar MANIFEST.MF, but none resolves the missing artifact problem.

Tim
  • 1
  • 1
  • 1
    *Compile seems to work as expected, and the build runs to successful completion.* Then what is your question? – Elliott Frisch Dec 03 '15 at 22:20
  • 1
    Tools.jar is part of every JDK. You dont need to include that anywhere. – Stefan Dec 03 '15 at 22:22
  • @Stefan Unless you need a compiler. – Elliott Frisch Dec 03 '15 at 22:23
  • @ElliottFrisch, Sorry, I wasn't clear. The question is how do I find what version to use to satisfy the eclipse error? I'm new to Maven, but I thought I understood that each dependency I'm defining needs groupID, artifactID, and version. Determining groupID and artifactID seems trivial. I don't understand how to "get" the version number for, as you correctly noted, a compiler dependency. – Tim Dec 05 '15 at 04:41

0 Answers0