簡體   English   中英

我如何在使用Maven為Linux上的Jenkins編譯cobertura-plugin時解決丟失的工件

[英]How do i resolve missing artifact while using maven to compile cobertura-plugin for Jenkins on linux

以下是標准輸出跟蹤:

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] ------------------------------------------------------------------------

您可能正面臨此處討論的問題。 您的JAVA_HOME可能指向JRE而不是JDK。

在我看來,這似乎是一個錯誤,不確定是在JDK中還是在Cobertura插件中。 僅在Mac OS上並且僅在使用Cobertura插件時才出現錯誤。 一個對我有用的解決方法是將其添加到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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM