Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven build fails with error: Could not find artifact ... at specified path - where the path is slightly incorrect

Running this command:

mvn package -Pcdh4

Here's the error in maven:

[ERROR] Failed to execute goal on project hdfs-nfs-proxy: 
Could not resolve dependencies for project 
com.cloudera:hdfs-nfs-proxy:jar:0.8.1: 
Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path 
/usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar -> [Help 1]

It's the last line in the path where /../ it goes back a directory, the path should be:

/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/tools.jar

I don't know much about maven or where it's picking up this path, I'm just trying to follow some build instructions.


With Debug:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.730s
[INFO] Finished at: Wed Apr 17 07:06:39 UTC 2013
[INFO] Final Memory: 8M/360M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project hdfs-nfs-proxy: Could not resolve dependencies for project com.cloudera:hdfs-nfs-proxy:jar:0.8.1: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path /usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project hdfs-nfs-proxy: Could not resolve dependencies for project com.cloudera:hdfs-nfs-proxy:jar:0.8.1: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path /usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:210)
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:117)
        at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.cloudera:hdfs-nfs-proxy:jar:0.8.1: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path /usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar
        at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:189)
        at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:185)
        ... 22 more
Caused by: org.sonatype.aether.resolution.DependencyResolutionException: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path /usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar
        at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:375)
        at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:183)
        ... 23 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path /usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
        at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:358)
        ... 24 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path /usr/lib/jvm/java-7-openjdk-amd64/jre/../lib/tools.jar
        at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:256)
        ... 26 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

mvn -v

root@hadoop-hdfsnfsproxy1:/opt/hdfs-nfs-proxy-release-0.8.1# mvn -v
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_15, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.5.0-27-generic", arch: "amd64", family: "unix"
root@hadoop-hdfsnfsproxy1:/opt/hdfs-nfs-proxy-release-0.8.1#
like image 415
David Parks Avatar asked Dec 27 '22 05:12

David Parks


1 Answers

Your JAVA_HOME should point to a JDK, not a JRE : tools.jar is a lib located in the lib directory of the JDK.

like image 55
user2147970 Avatar answered Jan 05 '23 19:01

user2147970