Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing artifact com.sun:tools:jar:1.5.0 maven

Tags:

maven

artifact

I am using maven in my web project this is how my pom.xml looks I use eclipse juno,with apache tomcat 7,I am runnning windows xp OS,"C:\Program Files\Java\jdk1.6.0_23\lib" is where my tools jar is.i tried hardcoding it in pom.xml but it was telling cant hard code.tried the below using profiles still same error "Missing artifact com.sun:tools:jar:1.5.0" please please help I am fed up since 1 week of googling

    </dependencies>
<profiles>
    <profile>
      <id>default-tools.jar</id>
      <activation>
        <property>
          <name>java.vendor</name>
          <value>Sun Microsystems Inc.</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>1.5.0</version>
          <scope>system</scope>
          <systemPath>${java.home}/../lib/tools.jar</systemPath>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

</project>


 I:\eclipse-jee-juno-RC3-win32\workspace\MYProject>mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MYProject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.594s
[INFO] Finished at: Sat Feb 23 20:49:53 GMT+05:30 2013
[INFO] Final Memory: 3M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MYProject: Could not resolve dependencies for project MYProject:MYProject:war:0.0.1-SNAPSHOT: Failure to find com.sun:tools:jar:1
.5.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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
'cmd' is not recognized as an internal or external command,
operable program or batch file.
I:\eclipse-jee-juno-RC3-win32\workspace\MYProject>
like image 443
HkFreaKuser1673718 Avatar asked Feb 22 '13 19:02

HkFreaKuser1673718


People also ask

What is missing artifact error in POM XML?

The error in pom. xml “missing artifact maven” occurs when the artifact is missing in local repository and remote repository. In eclipse, missing artifact maven error shows in the programs window. Maven is a software tool for building artifacts.


4 Answers

Its nothing to do with maven or pom. You are trying to run maven from eclipse and hence you need to make sure that you configure JDK properly in eclipse. I think the version of JDK mentioned in the eclipse is not that is installed. So change in eclipse and point the JRE System Library to your installed JDK path.

like image 73
AnirbanC Avatar answered Sep 18 '22 12:09

AnirbanC


If you're developing on Mac OS X, this is a known issue. According to the Mac Developer Library,

tools.jar does not exist. Classes usually located here are instead included in classes.jar.

This works for me on the Mac:

<dependency>
    <groupId>com.sun</groupId>
    <artifactId>tools</artifactId>
    <version>${java.version}</version>
    <scope>system</scope>
    <systemPath>${java.home}/../Classes/classes.jar</systemPath>
</dependency>
like image 25
beattidp Avatar answered Sep 19 '22 12:09

beattidp


When I use mac to compile the project which will use some classes under the tools.jar, I confront the same error, But at linux, everything is OK. So I add maven dependency explicitly, it works. I think the key point is checking if the systemPath is right. ps: My jdk version is 1.7,

    <dependency>
        <groupId>com.sun</groupId>
        <artifactId>tools</artifactId>
        <version>${java.version}</version>
        <scope>system</scope>
        <systemPath>${java.home}/../lib/tools.jar</systemPath>
    </dependency>
like image 26
avidya Avatar answered Sep 16 '22 12:09

avidya


Check if you have installed Java JDK 6 instead of JRE 6. Then check if you have configured and checked in Eclipse your Java Runtime correctly (Preferences -> Java -> Installed JREs).

like image 40
Ariel Carrera Avatar answered Sep 17 '22 12:09

Ariel Carrera