Missing artifact com.sun:tools:jar:1.5.0 maven
Asked Answered
E

8

16

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>
Enmity answered 22/2, 2013 at 19:27 Comment(5)
the log you posted don't seems linked with the problem you are describing. You have an error during the clean phase. The file Company.hbm.xml is probably currently in use by some other process.Zindman
@Zindman You are right I have fixed that problem,Now i am getting com.sun:tools:jar problem u can check i have edited my postEnmity
Your System path looks suspicious. I think its ${java.home}/lib/tools.jar. Btw. is your JAVA_HOME correctly set?Castorina
be sure that your ${java.home} is C:\Program Files\Java\jdk1.6.0_23\jre. If you have a problem with your java.home you can try to hardcode the full path :C:\Program Files\Java\jdk1.6.0_23\lib\tools.jar in the systemPath elementZindman
Quick solution which helped me was to point the JRE to the one available in the JDK folder.Haifa
A
13

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.

Authorized answered 20/1, 2016 at 15:10 Comment(0)
B
2

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>
Belligerency answered 8/11, 2013 at 19:52 Comment(0)
B
2

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>
Booboo answered 11/12, 2015 at 5:11 Comment(0)
B
1

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).

Baucom answered 20/4, 2015 at 22:40 Comment(0)
D
0

Can you try

    <dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>1.5.0</version>
    </dependency>

or else try to add a new dependency with the following information

Group ID: com.sun

Artifact ID: tools

Version: 1.5.0

This works for me.

Digitize answered 26/2, 2013 at 17:16 Comment(0)
S
0

If this issue occurs on mac, remove the dependency. and try. By default tools.jar will be included on run time. You have to add this dependency only for windows and linux machine.

                  <dependency>
                        <groupId>com.sun</groupId>
                        <artifactId>tools</artifactId>
                        <version>1.5.0</version>
                        <scope>system</scope>
                        <systemPath>${java.home}/lib/tools.jar</systemPath>
                    </dependency> 

Ref : maven reference

Socioeconomic answered 19/6, 2013 at 7:2 Comment(1)
just removing the dependency is not an option I am afraid, as developers just deleting those dependencies will break other developer builds on other platforms.Courtmartial
M
0

I also had a similar issue and fixed int the following way.

Go to lib directory of JDK installed path in command prompt. Execute the below command to install to install tools.jar. $mvn install:install-file -DgroupId=sun.jdk -DartifactId=tools -Dpackaging=jar -Dversion=1.6 -Dfile=tools.jar


http://parameshk.blogspot.in

Murraymurre answered 6/2, 2014 at 7:13 Comment(0)
P
0

Do as following:

add tools.jar dependency in your pom.xml manually. you can also refer to: http://maven.apache.org/general.html#tools-jar-dependency

<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.6</version>  
        <scope>system</scope>  
        <systemPath>${java.home}/../lib/tools.jar</systemPath>  
      </dependency>  
    </dependencies>  
  </profile>  
</profiles> 

The should be your jdk version, it seems it's just 1.6.

Postmillennialism answered 24/8, 2014 at 3:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.