IntelliJ gets errors when trying to download artifacts from NEXUS repo (sometimes)

已回答

Any ideas on why the following error happens?

If I see a red underline for an JAR that didn't download, I search in my maven repo to see if the file exists and I find that an error occurred when trying to download the file.  This doesn't happen all the time but when it does, it looks as follows.

This is an internal file that maven is using (mvn --version is Apache Maven 3.8.1):

cat $HOME/.m2/repository/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar.lastUpdated
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Tue Jun 29 03:08:31 UTC 2021
@default-ACME\ Nexus-https\://nexus.example.com/repository/maven-public/.lastUpdated=1624936111874
https\://nexus.example.com/repository/maven-public/.error=Could not transfer artifact org.codehaus.woodstox\:stax2-api\:jar\:3.1.4 from/to ACME Nexus (https\://nexus.example.com/repository/maven-public)\: Transfer failed for https\://nexus.example.com/repository/maven-public/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar

Notice the backslash in the URL.
My maven settings file has:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<mirrors>
<mirror>
<id>ACME Nexus</id>
<name>ACME Nexus</name>
<url>https://nexus.example.com/repository/maven-public</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>

 

 

0

What is the error in IntelliJ IDEA? 

Does "File | Invalidate caches and Restart" help to resolve that? 

Do you see anything in idea.log while the issue is being reproduced? 

0

I spent several hours troubleshooting this yesterday and now that I have it working I don't want to regress and waste time on it.    It may be a few days or more before I respond but if/when I have more info I will respond.

I recall running "File | Invalidate caches and Restart" and it not changing anything, but I can't say for certain, as I shut IntelliJ down several times and deleted my .m2/repository and tried several experiments.

Typically, howerver, I compile from the command line (mvn clean install) and then use IntelliJ to download "the rest".   IntelliJ tries to download some plugins that were not downloaded from the mvn clean install command and those attempts would fail with the error message in my initial post.

In one experiment (which has me working right now), I deleted my $HOME/.m2/repository and ran Build Project from inside IntelliJ.  This required IntelliJ to download all of the artifacts needed and there were no errors. 

Thanks for the response, and I'll respond when I have more info.

0

So the problem re-occurred today, so I'm going to try the suggestion.

> Does "File | Invalidate caches and Restart" help to resolve that? 

Nope that didn't work for me.

I looked t the log file and it just confirms that there was an issue downloading the NEXUS/maven artifacts.
From what I see (in the log file) this is not an IntelliJ problem, so I don't know that there is anything IntelliJ can do.  

I say this because the log files say things like this:

[INFO] Validation error:
[ERROR] Maven server structure problem

Below is a snippet of one of the failures on some publicly available artifacts.

Caused by: java.lang.RuntimeException: org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer com.google.code.gson:gson:pom:2.8.7 from https://nexus.example.com/repository/maven-public was cached in the local repository, resolution will not be reattempted until the update interval of KMS Nexus has elapsed or updates are forced. Original error: Could not transfer artifact com.google.code.gson:gson:pom:2.8.7 from/to KMS Nexus (https://nexus.example.com/repository/maven-public): Transfer failed for https://nexus.example.com/repository/maven-public/com/google/code/gson/gson/2.8.7/gson-2.8.7.pom
2021-07-21 17:24:40,376 [6950412] INFO - STDOUT - [INFO] Validation error:
2021-07-21 17:24:40,377 [6950413] INFO - #org.jetbrains.idea.maven - [INFO] Validation error:
2021-07-21 17:24:40,378 [6950414] INFO - STDOUT -
2021-07-21 17:24:40,378 [6950414] INFO - #org.jetbrains.idea.maven -
[ERROR] org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.google.code.gson:gson:jar:2.8.7
2021-07-21 17:24:40,383 [6950419] INFO - STDOUT - [ERROR] org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.google.code.gson:gson:jar:2.8.7[ERROR] Maven server structure problem
2021-07-21 17:24:40,383 [6950419] INFO - #org.jetbrains.idea.maven - [ERROR] Maven server structure problem
2021-07-21 17:24:40,384 [6950420] INFO - STDOUT -
2021-07-21 17:24:40,384 [6950420] INFO - #org.jetbrains.idea.maven -
[ERROR] org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.google.code.gson:gson:jar:2.8.7

 


When I look at the .m2/repository of what was downloaded this shows up

ls -l repository/com/google/code/gson/gson/2.8.7
total 4
-rw-rw-r-- 1 myname mygroup 586 Jul 21 01:31 gson-2.8.7.pom.lastUpdated

cat repository-2021-07-21/com/google/code/gson/gson/2.8.7/gson-2.8.7.pom.lastUpdated
#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
#Wed Jul 21 01:31:03 UTC 2021
@default-SVR\ Nexus-https\://nexus.example.com/repository/maven-public/.lastUpdated=1626831063628
https\://nexus.example.com/repository/maven-public/.error=Could not transfer artifact com.google.code.gson\:gson\:pom\:2.8.7 from/to KMS Nexus (https\://nexus.example.com/repository/maven-public)\: Transfer failed for https\://nexus.example.com/repository/maven-public/com/google/code/gson/gson/2.8.7/gson-2.8.7.pom

So the bottom line is that, I think you can consider this issue "closed" because it's not an IntelliJ problem.

Or if it is, then I don't understand why some days it can download successfully and other days it gets the above error.

The errors happen apparently randomly on different artifacts.

It's been a difficult problem to troubleshoot.

To date, the work around has been to delete my .m2/repository directory and redownload everything until everything is successfully downloaded (quite frustrating).

Actually maybe this is an IntelliJ problem, when I run maven clean install artifacts are downloaded without a problem.   I'm using:

which mvn
~/.local/maven/bin/mvn
mvn --version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: ~/.local/maven
Java version: 1.8.0_282, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.amzn2.0.1.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.14.231-173.360.amzn2.x86_64", arch: "amd64", family: "unix"

 

0

What IDE version do you use?

Could you please try the version from https://www.jetbrains.com/idea/nextversion/ It has several related improvements.

Also, is it possible to have a sample project and steps to reproduce this problem and IDE logs zipped? For uploading you can use https://uploads.jetbrains.com or any file sharing service.

Thank you very much in advance.

0

Andrey Dernov

> What IDE version do you use?

  I'm currently using 

IntelliJ IDEA 2021.1.1 (Ultimate Edition)
Build #IU-211.7142.45, built on April 30, 2021
Runtime version: 11.0.10+9-b1341.41 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Linux 4.14.231-173.360.amzn2.x86_64
GC: ParNew, ConcurrentMarkSweep
Memory: 3062M
Cores: 4
Registry: directory.access.checker.enabled=false, ide.balloon.shadow.size=0
Non-Bundled Plugins: com.ifengxue.plugin.jpa-support (2.0.7-RC3), org.jetbrains.kotlin (211-1.5.10-release-891-IJ7142.45)
Kotlin: 211-1.5.10-release-891-IJ7142.45

 

> Could you please try the version from https://www.jetbrains.com/idea/nextversion/ It has several related improvements.

Yes, I'll try it.  I was able to download it.

>  it possible to have a sample project and steps to reproduce this problem and IDE logs zipped?

The project is quite large and I'm not sure what subset of it will reproduce the problem, but I will try and use a brand new (IntelliJ created)  Spring-Boot project to see the problem occurs with that.  If that happens, I will be able to upload the project and logs.

I'm not sure when I'll have time to do this.  I end up loosing a day each time this happens but eventually everything downloads and I can continue with my work.  I got things to that point this morning so I need to make progress on my current tasking before I investigate this.  But if/when this happens again, I'll create the test project first and send it to you.

 

0

So after updating the latest version of IntelliJ 

IntelliJ IDEA 2021.2 RC (Ultimate Edition)
Build #IU-212.4746.52, built on July 20, 2021
Runtime version: 11.0.11+9-b1504.13 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 4.14.231-173.360.amzn2.x86_64
GC: ParNew, ConcurrentMarkSweep
Memory: 3062M
Cores: 4
Registry: directory.access.checker.enabled=false, ide.balloon.shadow.size=0
Non-Bundled Plugins: com.ifengxue.plugin.jpa-support (2.0.7-RC3)
Kotlin: 212-1.5.10-release-IJ4746.52

I'm seeing the same problem as described above.

One thing I noticed is that the error that was in the log file now appears on the Sync Build output that says


[INFO] Validation error:

[ERROR] org.apache.maven.model.resolution.UnresolvableModelException: mypkg:my-parent:pom:1.0.0 failed to transfer from https://nexus.example.com/repository/maven-public during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of KMS Public has elapsed or updates are forced. Original error: Could not transfer artifact mypkg:my-parent:pom:1.0.0 from/to KMS Public (https://nexus.example.com/repository/maven-public): transfer failed for https://nexus.example.com/repository/maven-public/my/pkg/my-parent/1.0.0/my-parent-1.0.0.pom
[ERROR] Maven server structure problem

 

0

So I created a SpringBoot project using New | Spring Initializr.  I selected:

- Java
- Maven
- Project SDK: 1.8.0_282
- Java: 8
- Packaging: Jar

I removed my $HOME/.m2/repository directory and ran File | Invalidate Caches (and restart).

So with nothing downloaded from NEXUS/Maven, I tried to build from within IntelliJ and got the same error as described above.

So the problem is not as intermittent as I thought.  It appears to be a problem with IntelliJ not being able to download or interact with NEXUS.   The version of NEXUS I'm using is: 

Sonatype Nexus Repository Manager
OSS 3.31.1-01

This may be a show stopper for me but for the time being I can first build outside of IntelliJ and then run from inside IntelliJ.

If you still need my idea.log file, let me know where I can upload it and I'll reset it and send you just this problem. 

0

Thanks for information!

I reported issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-274458. Please follow it for updates.

0

Thanks for reporting the issue.  I've struggled with this for years never taking the time to isolate the issue.  Thanks for creating the ticket.  Hopefully it's easy to fix once an environment is setup that can reproduce it. :-)  He said, knowing that might be difficult

Thanks for your help, I love the product and the support you and your team provides.

0

You are welcome!

0

You should check if there correct ca-bundle in certificate which nexus use to serve inbound ssl.

I solved the problem only after replacing self-signed certificate with trusted (including ca-bundle).

1

I found this via google and it seems exactly like my problem. Sometimes artifacts on the nexus are found, sometimes it will try to force an update and there is no vpn-connection and it doesnt take my cache, it instead fails with an error until I try again and again and it suddenly works.

0

@... I am facing same exception. Here is a line from the exception log which was created:
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: javax.enterprise.concurrent:javax.enterprise.concurrent-api:pom:1.0 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact javax.enterprise.concurrent:javax.enterprise.concurrent-api:pom:1.0 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/javax/enterprise/concurrent/javax.enterprise.concurrent-api/1.0/javax.enterprise.concurrent-api-1.0.pom

0

Ysharma1, the part of the error message you provided doesn't look related to the problem described in this topic. Could you please share with us the full IntelliJIDEA log? You can do it using the JetBrains Uploads service and post the ID you receive here. 

0

请先登录再写评论。