0
votes

Following is a stdout trace:

cobertura-plugin$ mvn clean package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.sun:tools:jar:1.5

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.5 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.5 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) org.jenkins-ci.tools:maven-hpi-plugin:maven-plugin:1.67
    2) org.kohsuke.stapler:maven-stapler-plugin:jar:1.15
    3) com.sun:tools:jar:1.5

----------
1 required artifact is missing.

for artifact: 
  org.jenkins-ci.tools:maven-hpi-plugin:maven-plugin:1.67

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  m.g.o-public (http://maven.glassfish.org/content/groups/public/)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Mon Jun 20 22:25:17 EDT 2011
[INFO] Final Memory: 9M/21M
[INFO] ------------------------------------------------------------------------
2

2 Answers

2
votes

You may be facing the problem discussed here. Your JAVA_HOME maybe pointing to the JRE instead of JDK.

1
votes

It seems to me like a bug, not sure whether it's in the JDK or in the Cobertura plugin. I get the error only on Mac OS, and only if I use the Cobertura plugin. A workaround that works for me is to add this to pom.xml:

<profiles>
  <profile>
    <id>osx_profile</id>
    <activation>
     <os>
       <family>mac</family>
     </os>
    </activation>
    <dependencies>
     <dependency>
       <groupId>com.sun</groupId>
       <artifactId>tools</artifactId>
       <version>1.6</version>
       <scope>system</scope>
       <systemPath>${java.home}/../Classes/classes.jar</systemPath>
     </dependency>
    </dependencies>
  </profile>
</profiles>