Sunday, June 8, 2014

'Maven Dependencies' references non existing library ... com\sun\tools\1.6\tools-1.6.jar'


>PROBLEM

  'Maven Dependencies' references non existing library ... com\sun\tools\1.6\tools-1.6.jar'    auth        Build path    Build Path Problem
Full Compilation Error Message:

  The container 'Maven Dependencies' references non existing library
    'D:\work\repolib\java\mvn_repo\com\sun\tools\1.6\tools-1.6.jar'    auth        Build path    Build Path Problem


>SOLUTION

This error is caused by this dependency:

        <dependency>
            <groupId>org.jboss.as</groupId>
            <artifactId>jboss-as-jpa-hibernate3</artifactId>
            <version>7.2.0.Final</version>
        </dependency>

It was substituted by another.

>ENV
eclipse, maven, java, hibernate


>DETAILED APPROACH

A build path problem usually indicates that a dependency is missing.
So, this kind of problem may have many reasons.
First check your development tool configuration.
If Eclipse, go to preferences, Build Path. Check also Project Facets.
Go to the pom.xml and check the compilation configuration version.
It must be the same of Eclipse's configuration.

Example:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

If Eclipse configuration is using version java 7, switch to 1.7 where it is 1.6.


After all this check up, if the problem remains, do the following:

1. Remove all dependencies from your pom.xml file and let it as follow:

    <dependencies>
    </dependencies>

2. Then insert the dependencies again using small groups (for instance 3 dependencies) until one of them triggers the target error.
Then isolate the dependency that causes the problem removing and test one by one in that group until the error disappears.


1 comment:

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...