gradle build consistently fails at download of random plugin - gradle

For two days now, I have the problem, that my gradle builds fail (pretty consistently, today only one in 15 succeeded) when downloading the gradle plugins. The plugin, thats download fails, seems random. Sometimes I cannot download the plugin afterwards "by hand", other times I can...
I had the same issue some time ago already (and maybe once more), but then "it fixed itself" after some hours (I think I tried stuff until lunch and afterwards everything was back to normal).
Here's the failing part of my log:
10:47:10 Download https://plugins.gradle.org/m2/com/jcraft/jzlib/1.1.2/jzlib-1.1.2.jar
10:47:10 Download https://plugins.gradle.org/m2/org/apache/ant/ant-antlr/1.8.4/ant-antlr-1.8.4.jar
10:47:10 Download https://plugins.gradle.org/m2/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/2.6.2/sonarqube-gradle-plugin-2.6.2.jar
10:47:10 Download https://plugins.gradle.org/m2/org/apache/ant/ant/1.8.4/ant-1.8.4.jar
10:47:43
10:47:43 FAILURE: Build failed with an exception.
10:47:43
10:47:43 * What went wrong:
10:47:43 A problem occurred configuring root project 'root'.
10:47:43 > Could not resolve all artifacts for configuration ':classpath'.
10:47:43 > Could not download sequence-library.jar (de.regnis.q.sequence:sequence-library:1.0.3)
10:47:43 > Could not get resource 'https://plugins.gradle.org/m2/de/regnis/q/sequence/sequence-library/1.0.3/sequence-library-1.0.3.jar'.
10:47:43 > Could not GET 'https://plugins.gradle.org/m2/de/regnis/q/sequence/sequence-library/1.0.3/sequence-library-1.0.3.jar'.
10:47:43 > Connect to jcenter.bintray.com:443 [jcenter.bintray.com/159.122.18.156] failed: connect timed out
I already found this github issue: https://github.com/gradle/gradle/issues/3326
There they argued, that it could have to do something with the feature "Avoid checking other repositories when dependency resolution in one repository fails" ( https://docs.gradle.org/4.3/release-notes.html#avoid-checking-other-repositories-when-dependency-resolution-in-one-repository-fails ), that was introduced in Gradle 4.3. In fact I sometimes get an 403 "resource not found" (not sure about the exact wording here) when I try to manully download a plugin from repo.jfrog.org.
I also already read about "sitting behind a proxy" thing. That might be the case (I have to check with our admins), but I think the fact, that in some rare cases the build succeeds, is an argument against it, right?
If there is any more info I can help with, please ask :)
Any help is appreciated, because this is a really annoying state right now. Thanks in advance!

Sadly I cannot really give a solution for the problem we encountered. It might be a problem or a new configuration at the jcenter-side, it might have to do something with the proxy thing.
We fixed it by proxying everything through our internal repos and backup the artifacts there, what probably everyone should do who has the infrastructure, bc this really removes traffic from the official repos.

Related

Unable to find Groovy method when building Rhino with Intellij IDEA

While trying to build https://github.com/mozilla/rhino, I'm getting Unable to find method on org.codehaus.groovy.runtime.StringGroovyMethods.
so the build fails, and I'm unable to test Rhino built from source code, which is the goal.
Steps Taken
From the opening screen in IntelliJ, I check out the project:
I get this error Unable to find method ''java.lang.String org.codehaus.groovy.runtime.StringGroovyMethods.capitalize(java.lang.String)'' right away, which I have not been able to fix:
There are two suggestions in the above Re-download dependencies and sync project and Stop Gradle build processes. I have tried both with no improvement.
When I look at the build.gradle file, I see another suggestion ...configure Gradle wrapper to use distribution with sources.... This also does not get past the missing Groovy method problem.
I have looked on S.O. for similar issues and tried various things under File > Settings > Build, Execution, Deployment, but I realized I'm over my head since, conceptually, I'm not sure what I need and where that would go in the settings.
The command line items from the readme work as expected, but going back to File > Build still fails (added after tim_yates comment).
What changes are required to the IDE or to the build definitions to allow Mozilla Rhino to build properly?
I installed the latest (2022.1) version of IntelliJ IDEA Community Edition. During the install, it asked if you wanted this IDE to be associated with Groovy file types, and I answered in the affirmative.
On this new install, the Unable to find method on org.codehaus.groovy.runtime.StringGroovyMethodserror did not appear, so the problem was solved by upgrading the IDE (and also that required updating GIT).

SemaphoreCI instability when downloading big maven dependencies

We are using SemaphoreCI as continuous-integration. Some of our maven dependencies are pretty big (like order of hundreds of megabytes).
A behavior that we are observing is that, our builds fails often due to failures in downloading the dependencies; we have to restart it once or twice to make it pass, in order to move on, which is really annoying.
I wonder if anyone has any suggestions/experiences regarding this problems.
Milana from SemaphoreCI here.
It would be good to cache these dependencies between builds. If your project is recognized as a Maven project on Semaphore, related dependencies will be cached by default. For such a project Semaphore caches ~/.m2 directory. To read more about this please refer to this page.
If you're still experiencing similar issue or if you would like to learn more about SemaphoreCI, please send us an email at support#semaphoreci.com and we'll do our best to help you out!

TeamCity - Behind Proxy causing build failure

Below is an error message I am getting trying to build a current project,
I am behind an enterprise proxy but this has only happened this morning after building fine for the past couple of months.
the current installed version of nuget is 2.8.3 and nuspec is 3.0.0.
I see it says it needs credentials but this has never happened before and i am not sure how to get around this in Teamcity.
Also all my other solutions are building fine so it makes it even more confusing as they are all built on the same template.
Okay, if I were less impatient and did some back tracking on my check-ins, I would have noticed that I had checked in .nuget/packages.config. which had dependencies on these packages above.
I removed these from the .nuget/packages.config and this resolved the issue.
Hope if anyone in the future is having the similar issues that this will help you too.

compiling with maven and nexus stuck on downloading artifacts

we are using here nexus 1.9.2.4 and maven 2.2.1 and on one pc (and only that one) when we try to compile our code using maven, it get stuck on downloading jars.
for example it'll be stuck on:
Downloading: http://mainserver:8081/nexus/content/groups/public/org/codehaus/mojo/javascript/javascript-maven-plugin/1.0-alpha-1-SNAPSHOT/javascript-maven-plugin-1.0-alpha-1-20090530.211438-7.jar
17/54K
and won't continue at all. tried using maven 3.0.4, but with the same result.
the machine runs windows 7.
any advise will be appreciated
This appears to be a bug related to using Maven on Java 7 and 64bit Windows. I have been experiencing similar problems.
The maven bug report and some discussion can be found here:
http://jira.codehaus.org/browse/MNG-5162
Workaround documented here:
https://cwiki.apache.org/confluence/display/MAVEN/ConnectException
Add -Djava.net.preferIPv4Stack=true to MAVEN_OPTS
Maven really needs to have some kind of support for mirrors and failsafes for the qurkeyness of the internet. Really, not everyone is going to be able to have a peered connection with the Oracle and Apache repositories. Every internet connection is going to drop a packet here and there, the "get a new ISP" response from Maven fans wouldn't help even if it were an option.
I've been staring at a 400k download go nowhere for about 10 minutes. I've noticed it gets stuck on the same files every time I wipe my repo too (bad sector maybe?). Which is a complete pita since it doesn't seem I can specify mirrors for it (short of hacking a hosts file). If you're a Maven project leader, look to Aptitude for ideas on what Maven could be.
EDIT:
I found a solution to my Maven problem here.
https://jira.codehaus.org/browse/MNG-5162
Under Ubuntu 13.10 simply...
sudo gedit /etc/environment
Add
MAVEN_OPTS="-Djava.net.preferIPv4Stack=true"
Save
Close
Reload terminal.

Maven hangs on Windows

I am trying to build a project using maven (mvn). As you might know (for
people who used mvn before), if the project is missing any dependencies to
build, mvn first downloads these dependencies from somewhere (central
repositories, I guess). My problem is that on Windows 7, mvn hangs during
this download phase non-deterministically and often. Yesterday, I have
waited for 10 hours to download a dependency as small as 300-400 kbs.
Does anybody know how to fix this or what is the reason?
Thanks,
Setting MAVEN_OPTS to -Djava.net.preferIPv4Stack=true fixed this problem for me (This option disables IPv6 and uses AF_INET sockets exclusively).
I found this solution as an answer to the Maven stuck on downloading dependencies when using java 7 issue on http://jira.codehaus.org.
See also
http://blog.bielu.com/2011/11/hotspot-64bit-server-hangs-on-socket.html
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7077696
http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=8cbb21d29d4841603fb62a4c440?bug_id=7183450
[ Ack: thanks # David Hartveld for more info on this issue. ]
If you are running AVG, try disabling it.
http://comments.gmane.org/gmane.comp.jakarta.turbine.maven.user/122046
I don't have an answer for this but I disagree with the previous comment. I was having the same problem. For some dependencies, I was able to finish the download after several retries. It doesn't seem like a networking error on my end would cause these symptoms. I suspect that the mirror is overloaded. I had success on the remaining dependencies by switching to European mirrors. I tried going East from my location since it's now the middle of the night there.
Resolve your networking issues. If the downloads are failing/hanging, it's not anything inside Maven. When it downloads artifacts, it shows you the URLs being downloaded. You can use these URLs to troubleshoot your problems. Try them in a browser, from wget, or whatever.

Resources