Missing Artifact Com.Sun:Tools:Jar

Could not find artifact com.sun:tools:jar:0

tools.jar removed from Java 9+

You're on JDK 11. No tools.jar found there.

JEP 220: Modular Run-Time Images removed both tools.jar and rt.jar from the lib folder, as of Java 9.

Removed: rt.jar and tools.jar

The class and resource files previously stored in lib/rt.jar,
lib/tools.jar, lib/dt.jar, and various other internal JAR files are
now stored in a more efficient format in implementation-specific files
in the lib directory. The format of these files is not specified and
is subject to change without notice.

This change is part of adding the Java Platform Module System, a.k.a. Project Jigsaw.

To upgrade Checkstyle, use later versions, such as:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.18</version>
</dependency>
</dependencies>
</plugin>

Notice the inner dependency block.

Consult a Maven repo for versions of Apache Maven Checkstyle Plugin and of Checkstyle.

Build error: missing artifact com.sun:tools:jar:1.6

This artifact is always handled as a 'system' dependency. It is never stored in a repo.

See https://web.archive.org/web/20151031071007/http://maven.apache.org/general.html#tools-jar-dependency for the details.

if there is no tools jar, and you aren't on a Mac, you are trying to use a JRE when the requirement is a JDK. You can't turn one into the other by copying file.

Maven : Missing artifact com.sun:tools:jar:1.6.0 compile time exception in POM.xml

java.home is a System property which generally points to the jre directory and you are getting an error as you have pointed to a jar which doesn't exist.

In case you want to refer to an environment variable within your pom file, use the below syntax.

${env.variable_name}

In your case, it should be ${env.JAVA_HOME} as seen below

<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.6.0</version>
<scope>system</scope>
<systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
</dependency>

Update: As lexicore has mentioned, this wont work with MAC as the MAC JDK has a different file structure.



Related Topics



Leave a reply



Submit