Jenkins中的Maven构建错误(半时间敏感)

Jos*_*hea 7 maven jenkins

我通常只是等到我们的开发人员上网,但那将是另外12个小时,在这种情况下为时已晚,让我达到某个目标.

但是,我试图通过我们的Jenkins面板构建我们的网站项目,并且构建失败.我已经确定它不是我对它所做的最新改变的b/c,因为我还原并仍然有同样的问题.

而且我已经阅读了错误信息,但是对于这个问题的确定答案和/或解决方案,我不了解编程已经足够了(除了我自己已经教过的时间,这并不多).所以我想我会在这里问,并可能及时得到一些答案/可能的解决方案.提前谢谢你!

[ERROR] Failed to execute goal on project moduleCommon: Could not resolve 
dependencies for project com.mtgprice:moduleCommon:jar:1.0: Failed to collect dependencies
at com.google.appengine.tools:appengine-gcs-client:jar:RELEASE
-> >com.google.http-client:google-http-client:jar:[1.19.0,2.0): No versions >available for
com.google.http-client:google-http-client:jar:[1.19.0,2.0) within >specified range -> [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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :moduleCommon>Build step 'Invoke top-level Maven targets' marked build as failure
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE
Run Code Online (Sandbox Code Playgroud)

Arr*_*rix 9

我今天也有同样的问题.com.google.http-client的最新版本是1.22.0,绝对属于[1.19.0,2.0]范围.

不知道是什么导致了分辨率错误,但这是一个hacky工作.

在您当地的maven仓库中找到appengine-gcs-client-0.6.pom.

例如,我的是$ HOME/.m2/repository/com/google/appengine/tools/appengine-gcs-client/0.6/appengine-gcs-client-0.6.pom.

将版本范围更改为最新版本.

<dependency>
  <groupId>com.google.http-client</groupId>
  <artifactId>google-http-client</artifactId>
  <!-- <version>[1.19.0,2.0)</version> -->
  <version>1.22.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

一旦我找到真正的解决方案,我会更新答案.

更新:我认为问题的原因是http://central.maven.org/maven2/com/google/http-client/google-http-client/maven-metadata.xml已过时的内容.

<?xml version="1.0" encoding="UTF-8"?>
<metadata>
  <groupId>com.google.http-client</groupId>
  <artifactId>google-http-client</artifactId>
  <versioning>
    <latest>1.5.3-beta</latest>
    <release>1.5.3-beta</release>
    <versions>
      <version>1.5.0-beta</version>
      <version>1.5.3-beta</version>
    </versions>
    <lastUpdated>20111021163718</lastUpdated>
  </versioning>
</metadata>
Run Code Online (Sandbox Code Playgroud)

您还可以更新pom.xml以排除有问题的传递依赖项并明确添加它.

<!-- mapreduce -->
<dependency>
    <groupId>com.google.appengine.tools</groupId>
    <artifactId>appengine-mapreduce</artifactId>
    <version>0.8.5</version>
    <exclusions>
        <exclusion>
            <!-- TODO remove me after the issue is fixed https://github.com/google/google-http-java-client/issues/330 -->
            <groupId>com.google.http-client</groupId>
            <artifactId>google-http-client</artifactId>
        </exclusion>
    </exclusions> 
</dependency>

<dependency>
    <groupId>com.google.appengine.tools</groupId>
    <artifactId>appengine-gcs-client</artifactId>
    <version>0.6</version>
    <exclusions>
        <exclusion>
            <!-- TODO remove me after the issue is fixed https://github.com/google/google-http-java-client/issues/330 -->
            <groupId>com.google.http-client</groupId>
            <artifactId>google-http-client</artifactId>
        </exclusion>
    </exclusions> 
</dependency>

<!-- Add the transitive dependency explicity  -->
<dependency>
    <groupId>com.google.http-client</groupId>
    <artifactId>google-http-client</artifactId>
    <version>1.22.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)