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.
Related
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.
When choosing the Create New Project option after launching IntelliJ 2017.2, I get this endlessly spinning wheel on the Maven tag, saying “Loading archetype list…”.
Any way to get to a Maven archetype?
I just hit this on 2017.2.3 (just updated now) on Fedora 24 (oops time to upgrade)
The immediate solution was to change the Maven settings (File > Settings > Maven) to use my on-machine Oracle JDK 1.8.0_144 instead the default "internal JRE" 1.8.0_152. Btw, the importer uses JVM option -Xmx768m by default.
And we go on...
Wait
Loading the full list of Maven archetypes seems to be quite an exertion for IntelliJ. Surprising, as I don't recall any such long delays in NetBeans.
So wait, be patient. May take a couple minutes. Make tea, pat the dog. Wait for the fan on your computer to spin up and then quiet again.
Use more memory
I currently have VM options for importer set to -Xmx2048m as shown in the Answer by Tonhofer.
I do not know if this point was key, but my problem has gone away «knock-on-wood». So this might be helping.
FYI… I have a 16-gig MacBook Pro (Retina, 15-inch, Late 2013) running Sierra 10.12.6 with two Java implementations, Java 8 Update 144 from Oracle and Java 9 beta jdk-9+181 from OpenJDK.
Quit, update repositories
While I do not understand what all is going on, it seems like this has been a workaround for me.
Quit IntelliJ, then launch again.
In Preferences/Settings, go to Build, Execution, Deployment> Build Tools > Maven > Repositories. Click each of the listed repositories, and click the Update button. A spinning wheel appears for the duration of the update.
A copy of each repository’s data is being downloaded and parsed on your local machine, descriptions of all the libraries known by that repository. Some of the repositories may be quite large with many listed projects. So this process may take a while, possibly more than several minutes.
When the updates are complete, try the New Project feature again.
Add more memory
Settings > Maven > Importing
VM options for importer -Xm1024m (or more)
Closing out of IntelliJ and creating the project from this window helped:
IntelliJ Welcome Screen
I managed to solve the issue by updating the NVIDIA driver, based on IntelliJ logs. Anything else did not work for me. The list loads now in a few seconds..finally.
Edit:
as Basil suggested, here are some clarifications. I am on Windows 10 Home Edition 64b, and I have IntelliJ 2017.2 with Java 1.8.0_152. I checked IntelliJ logs and followed a standard procedure: I went on Google and I searched by that exception (I can't remember what and where) and found a site where someone suggested to update my nVidia drivers. For the update, you only need to go to nVidia site and from that on it should be easy. I was on a 2016 driver and got to 2018 version after the update. I also have the previously added configurations from other comments.
Last year I got virtual server for my server needs, configuration is not great, but things work without problem... Few months ago I installed Nexus Repository manager and after that I have daily problem with tomcat... I now restart machine every night, but still it seems that nexus is unavailable most of time.
I am working on OS project and we need to have repository manager (RM) available to host all our stuff and also all libraries our project needs...
I have currently 3 options (how to solve this problem):
Downgrading maven version to 1.6 (or at least some that is stable and doesn't need so much resources)
Using artifactory (their package seems to be the same size as nexus, but I don't know if it will be better - resource wise)
Using archiva (no idea how stable this is and how good it is)
I am thinking about going with option 3, I just don't know if this is right solution. I am sure some of you have your own RM running, what would you recommend? Do you have perhaps any other options? If I use option 1, which version would you recomend...
Thanks in advance,
Andy
By "downgrading Maven version to 1.6" I assume you're referring to the Java version, as if you're using such an old Nexus, then it doesn't shock me that you're having problems. Upgrade your Java to 1.7.x, as well as your Nexus to the latest one.
Archiva and Artifactory are always options, but I don't think the problem is in Nexus itself, but rather your setup (and you haven't mentioned anything about it).
What version of Java, Nexus, Tomcat are you using?
Also, by "OS project", I assume you mean "OSS" (open source) project. If so, you can use Sonatype's OSS hosting. I've described how to set up an OSS project (using Github, BuildHive and Maven Central) here. You can also just skip to using Maven Central directly, checking here. I think this would be a better option for you, if you're not familiar enough with managing your own repository manager.
I would suggest to run Nexus with the native jetty as supplied by the default download bundle instead of on tomcat. This will give you better performance and also better support.
Of course if you can get all libraries into the Central Repository via OSSRH it would be even easier since you could get by without maintaining a repository manager altogether.
Whenever I try to run mvn clean install on my code, maven runs and start downloading jars, after downloading some jars It give an error i.e. Not able to open xxxxx.jar
On first though i changed that particular jar , but this error is coming for more jars, then i tried to take my friends repository.
And then it works fine for the jars already available in my friends repository. But whenever it have to download new jars from central repository same error occurs.
I tried 100 of time deleting .m2 folder and create it again but no luck.
I also tried switching maven installations or version from different friend and maven official websites but still No Luck
I am fed up of this. Trying from last week.
Please Help
Just a quick suggestion from the top of my head:
You could take a look at the .jar-Files that get downloaded using a text editor or even better some hex-editor. Depending on the network from that you are accessing the repository there might be some kind of proxy-server that intercepts the jar-download-requests and sends back some html-page - at least it might do so in our company-network.
If the text-editor just shows some strange characters try opening the jar-file with some zip-tool (eg. 7zip) and see if that shows some error.
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.