Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven build error in Jenkins (Semi time sensitive)

Tags:

maven

jenkins

I'd normally just wait until our Dev comes online, but that'll be around another 12 hours and that'll be too late in this case, for me to meet a certain goal.

But, I was trying to build our website project via our Jenkins panel and the build failed. I've determined it was NOT b/c of the latest changes I'd made to it though, as I reverted and still have the same issue.

And I've read into the error abit, but don't understand programming nearly enough (other then what I've taught myself over time, which isn't much) to come to a definitive answer and/or solution of this problem. So I figured I'd ask here, and possibly get some answers/possible solution in time. Thank you ahead of time!

[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
like image 680
Joshua Rhea Avatar asked Jul 23 '16 01:07

Joshua Rhea


1 Answers

I have the same problem today. The latest version of com.google.http-client is 1.22.0 which definitely falls into the range [1.19.0,2.0).

Not sure what's causing the resolution error but here is a hacky work around.

Find appengine-gcs-client-0.6.pom in your local maven repo.

e.g. Mine is under $HOME/.m2/repository/com/google/appengine/tools/appengine-gcs-client/0.6/appengine-gcs-client-0.6.pom.

Change the version range to the latest version.

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

I'll update the answer once I figure out a real solution.

Update: I think the cause of the issue is that http://central.maven.org/maven2/com/google/http-client/google-http-client/maven-metadata.xml has outdated content.

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

You can also update your pom.xml to exclude the offending transitive dependency and add it explicitly.

<!-- 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>
like image 159
Arrix Avatar answered Oct 03 '22 23:10

Arrix