使用maven下载Archiva Jars时构建失败

时间:2012-11-07 14:46:11

标签: maven jenkins maven-3 archiva

我想用maven 3下载Archiva Rest API jars,这样我就可以制作一些Rest API,而且我总是遇到构建失败。这是我的POM:

<dependency>
  <groupId>org.apache.archiva</groupId>
  <artifactId>archiva</artifactId>
  <version>1.4-M3</version>
</dependency>
<dependency>
  <groupId>org.apache.archiva</groupId>
  <artifactId>archiva-rest-api</artifactId>
  <version>1.4-M3</version>
</dependency>

我总是有这个错误:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Remote Deployment 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/kohsuke/access-modifier-checker/maven-metadata.xml
Downloaded: http://repo.maven.apache.org/maven2/org/kohsuke/access-modifier-checker/maven-metadata.xml (335 B at 1.6 KB/
sec)
Downloading: http://repo.maven.apache.org/maven2/org/kohsuke/stapler/stapler/maven-metadata.xml
Downloaded: http://repo.maven.apache.org/maven2/org/kohsuke/stapler/stapler/maven-metadata.xml (333 B at 5.1 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/apache/archiva/archiva/1.4-M3/archiva-1.4-M3.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.820s
[INFO] Finished at: Wed Nov 07 15:38:03 CET 2012
[INFO] Final Memory: 25M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project remote-deployment-new: Could not resolve dependencies for project com.ebiznext
.plugins:remote-deployment-new:hpi:1.0: Could not find artifact org.apache.archiva:archiva:jar:1.4-M3 in central (http:/
/repo.maven.apache.org/maven2) -> [Help 1]
....

我该如何解决?

[编辑]事实上,我正在研究一个Jenkins插件,我希望这个插件能够在Archiva中下载一些罐子。为此,我会做一些休息服务。这就是我需要这些依赖项的原因。要在archiva实例上进行Rest调用,我们必须添加archiva-rest-api依赖项等等。问题是它没有下载它们(archiva-rest-api,jackson,apache cxf)。这是我的POM:

  <dependencies>
   <dependency>
  <groupId>org.codehaus.jackson</groupId>
  <artifactId>jackson-jaxrs</artifactId>
  <version>1.9.9</version>
</dependency>
<dependency>
  <groupId>org.codehaus.jackson</groupId>
  <artifactId>jackson-xc</artifactId>
  <version>1.9.9</version>
</dependency>
<dependency>
  <groupId>org.codehaus.jackson</groupId>
  <artifactId>jackson-core-asl</artifactId>
  <version>1.9.9</version>
</dependency>
<dependency>
  <groupId>org.apache.cxf</groupId>
  <artifactId>cxf-bundle-jaxrs</artifactId>
  <version>2.6.3</version>
  <exclusions>
    <exclusion>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
    </exclusion>
    <exclusion>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
    </exclusion>
    <exclusion>
      <groupId>org.codehaus.jettison</groupId>
      <artifactId>jettison</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<!-- <dependency>
  <groupId>org.apache.archiva</groupId>
  <artifactId>archiva-rest-api</artifactId>
  <version>1.4-M4</version>
</dependency> -->
   </dependencies>
    <!-- get every artifact through repo.jenkins-ci.org, which proxies all the artifacts that we need -->


<repositories>
    <repository>
      <id>repo.jenkins-ci.org</id>
      <url>http://repo.jenkins-ci.org/public/</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>repo.jenkins-ci.org</id>
      <url>http://repo.jenkins-ci.org/public/</url>
    </pluginRepository>
  </pluginRepositories>

2 个答案:

答案 0 :(得分:0)

您的错误包括第一个依赖项 - org.apache.archiva:archiva不包含JAR工件,Maven在找不到它时会抱怨(请参阅Maven中心的directory listing)。

尝试删除此依赖项并再次尝试。

答案 1 :(得分:0)

也许在这里查看一些依赖项是详细的http://archiva.apache.org/docs/1.4-M3/adminguide/webservices/rest.html