Intellij can not download Sources and Documentation

已回答

Hello,

First I want to say that I don't have this problem at home, only at work.

Now at work I have to use corporate proxy settings witch I have configured for maven.

Maven is downloading it's dependencies instantly and I have no issues with that. Even Intellij Database drivers get downloaded through proxy as well and I have no issues with that either.

But when ever I try to download "Sources and Documentation" it just doesn't work. It tells me  "Sources not found for: org.springframework:spring-web:5.3.2". Even though the dependency it self gets downloaded. It does that for every single dependency.

Can someone please tell me how exactly is Intellij searching for "Sources and Documentation" so I might try to fix it

0

Hello Aleksandar,

Are you able to download the sources from the terminal using these commands?

Can you also drop the idea.log file (Help | Show Log in...) to https://uploads.jetbrains.com and provide the upload id?

1

Log id:  2020_12_31_7TuJug8dxt9qKyUr

This what happaned after I tried to download sources for Spring Boot Core.

0
Caused by: java.net.ConnectException: Connection timed out: connect
at java.base/java.net.PlainSocketImpl.connect0(Native Method)
at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:101)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
at java.base/java.net.Socket.connect(Socket.java:609)
at org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:368)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
  • Are you able to download the jar with mvn from the terminal?
  • Can you send a screenshot of your File | Settings | Appearance & Behavior | System Settings | HTTP Proxy config page?

Also, what Maven version is used (File | Settings | Build, Execution, Deployment | Build Tools | Maven)?

0

1) - Using the commands you gave me worked perfectly and it downloaded sources and documentation! I think the first command downloaded both the sources and the documentation even.

mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc

2) - Maven version 3.63

3) - When ever I go to  File | Settings | Appearance & Behavior | System Settings | HTTP Proxy

When ever i click test connection, it tells me, that it was successful,  so I assume they are properly setup.

 

0

The issue could be caused by the local or corporate firewall blocking connections. Notice the local firewall can block it per process and limit connectivity for the Maven process spawned by the IDE. Network firewall can do some filtering and block connections for certain resources or file types.

To further debug proxy problems you can add the following in Help | Diagnostic Tools | Debug Log Settings and inspect idea.log after reproducing the problem:

#com.intellij.util.io.HttpRequests
#com.intellij.util.proxy.CommonProxy
0

Hello,

I did what you said. This log file (Log file id: 2021_01_06_KjLKvifWba7jfGAB) was generated when I tried to use the Intellij "Download Sources and Documentation" command after I pasted the commands you gave me, for a newly created project from start.spring.io.

Keep in mind the command from the terminal

mvn dependency:sources

works perfectly, so I have a work around.

Log file id: 2021_01_06_KjLKvifWba7jfGAB

 

0

IDE fails to connect b/c of the connection timeout:

Caused by: java.lang.RuntimeException: org.apache.maven.wagon.TransferFailedException: Transfer failed for https://repo.maven.apache.org/maven2/org/springframework/spring-core/5.3.2/spring-core-5.3.2-javadoc.jar
at org.apache.maven.wagon.providers.http.wagon.shared.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1242)
at org.apache.maven.wagon.providers.http.wagon.shared.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1138)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:126)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run(WagonTransporter.java:567)
at org.eclipse.aether.transport.wagon.WagonTransporter.execute(WagonTransporter.java:435)
at org.eclipse.aether.transport.wagon.WagonTransporter.get(WagonTransporter.java:412)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:457)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:364)
... 29 more
Caused by: java.lang.RuntimeException: org.apache.maven.wagon.providers.http.httpclient.conn.HttpHostConnectException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/199.232.16.215] failed: Connection timed out: connect
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.maven.wagon.providers.http.httpclient.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.maven.wagon.providers.http.httpclient.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at org.apache.maven.wagon.providers.http.wagon.shared.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:1002)
at org.apache.maven.wagon.providers.http.wagon.shared.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:1160)
... 38 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.base/java.net.PlainSocketImpl.connect0(Native Method)
at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:101)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
at java.base/java.net.Socket.connect(Socket.java:609)
at org.apache.maven.wagon.providers.http.httpclient.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:368)
at org.apache.maven.wagon.providers.http.httpclient.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
... 48 more

 

How do you configure Maven proxy settings? Please Try using same Maven in IDE (Settings | Build, Execution, Deployment | Build Tools | Maven | Maven home path) and Maven settings (Build Tools | Maven | User settings file).

>Keep in mind the command from the terminal

When you execute Maven from terminal it runs different process and uses different JDK. If you have antivirus/firewall please try with it disabled or make sure that IDE settings directories IDE installation home and project files are excluded from the scan.

 

Please also try to define proxy settings in Settings | Appearance & Behavior | System Settings | HTTP Proxy.

0

Hello,

I have the same problem.

The problem started from version 2019.3.1 and above. Version 2019.2.4 (and below) successfully downloads Sources and Documentation with the same settings.

 

0

Quelgun As a general troubleshooting step, try using the current version of the IDE (2021.2.x) 

If this does not help, please share the logs folder compressed via https://uploads.jetbrains.com/ and tell me the upload ID. 

The problem from the initial post has been caused by the misconfiguration of Maven proxy, so your case is hardly related. 

0

Hello.

I have the same problem and the same log error.

Upload id: 2022_01_05_V3xM1vggcf7XDR5y (file: idea.log)

What i did

  1. I added a certificate of proxy to truststore (cacerts) of java (JAVA_HOME) and to IDEA's jbr (for "Reload of Maven Projects").
  2. I added proxy in maven settings.
  3. I added proxy in IDEA.

What i have

  1. Maven from the terminal work fine (all functions).
  2. In Idea run maven build work fine.
  3. In Idea "Reload of Maven Projects" / "Reload project" work fine (just after i added proxy cer to jbr truststore of IDEA).
  4. In Idea "Download Sources/Documentation" doesnt work

PS1

If i add insecure mirror for central repository, "Download Sources/Documentation" will works fine.

<mirror>
<id>mirror-central-insecure</id>
<mirrorOf>central</mirrorOf>
<url>http://insecure.repo1.maven.org/maven2/</url>
<blocked>false</blocked>
</mirror>

PS2

In IDEA version 2019.2.4 and below i dont have this problem. In IDEA version 2019.3.1 and above (and latest) i have this problem. Probably some changes in maven plugin.

Thank you.

0

>I added a certificate of proxy to truststore (cacerts) of java (JAVA_HOME) and to IDEA's jbr (for "Reload of Maven Projects").

Quelgun the custom certificate must be added into the JDK which is used by Maven for importing: Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing | JDK for importer.

>If i add insecure mirror for central repository, "Download Sources/Documentation" will works fine.

Note that if you would use the latest Maven version to date (3.8.1+) - by default it blocks non-secure repositories now. See https://stackoverflow.com/a/70215033/2000323 about this and available solutions. Btw latest IDE versions have built-in the suggestions for this problem.

0

Quelgun the custom certificate must be added into the JDK which is used by Maven for importing: Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Maven | Importing | JDK for importer.

It helps for "Reload of Maven Projects", but doesn't help for "Download Sources and/or Documentation".

These two functions are obviously handled differently by IDEA (in the certificate part), and "Download Sources and/or Documentation" has some problems.

0

Documentation and sources download are handled by the main IDE JVM. For this please try to add the certificate into the IDE bundled JDK.

There is a related request for an enhancement: https://youtrack.jetbrains.com/issue/IDEA-173599

0

The problem still persists in IDEA 2023.1 Ultimate Edition.  The workaround to run

mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc

in IDEA still works.  So maybe IDEA could just run these maven commands when the user selects the function to download sources / JavaDoc?

1

The problem still persists in IDEA 2023.1 Ultimate Edition.  The workaround to run

mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc

in IDEA still works.  So maybe IDEA could just run these maven commands when the user selects the function to download sources / JavaDoc?

The problem still persists in 2023.2.2

I need to execute the command to download sources: mvn dependency:sources

0

Hello, Ulisses!

This issue is often related to networking problems/misconfiguration.

Can you please provide the logs (Help → Collect Logs and Diagnostic Data) for investigation?

You can upload the logs here and share the upload ID.

0

This is a BUG with IntelliJ that applies to any attempt at download artifacts directly through the IDE. It also applies to downloading the drivers for database toolwindow.


If your business and dev teams are smart, they would have blocked direct access to public artifact repositories and instead setup a local network cache/proxy like Nexus or Artifactory, and you would have setup the `settings.xml` file in your maven user home (or `init.gradle(.kts)` in the gradle user home to redirect all traffic to the local network caches. 

The problem is that Intellij is trying to download the files directly from maven central, ignoring defined repositories in your project, proxies you have defined in `settings.xml`, and any already downloaded sources and javadoc in your local  machine caches (either `~/.m2` or `~/.gradle`). 

Solution:

1. Allow users to define a default maven artifact repositories to be used when IntelliJ downloads java dependencies and sources.
2. Before making a remote call to download java artifacts, first check your local cache, then the repositories defined in the project (in the order they were defined), and finally the default artifact repository defined in IntelliJ settings.

0

Jonathan Hoopes IDEA should respect such settings when downloading Sources/Documentation.

If you notice such settings being ignored, can you please share more details about your usage scenario, environment and IDEA Logs (Help → Collect Logs and Diagnostic Data) so we can investigate and resolve the issue.

0

I am seeing the same problem in the 2024.2 EAP. (Build #IU-242.10180.25, built on May 15, 2024).

I have the IntelliJ option to import sources/documentation enabled and also behind a corporate proxy which is configured in both my .m2/settings.xml and IntelliJ.

Interesting is the contents of the “*.lastUpdated” files for a single Maven GAV.

Prior to import, I deleted all files from my ~/.m2/repository for the ‘log4j-core-2.23.1’ artifact and ran a Maven “Reload Project” from IntelliJ.

The JAR file is successfully downloaded and in the 'log4j-core-2.23.1.jar.lastUpdated' file I see:

#Wed May 22 12:55:18 CEST 2024
https\://repo.maven.apache.org/maven2/.lastUpdated=1716375318837

The sources-JAR could not be downloaded (although it is present on Maven Central) and in the ‘log4j-core-2.23.1-sources.jar.lastUpdated’ file I see:

#Wed May 22 12:57:56 CEST 2024
https\://repo.maven.apache.org/maven2/.error=Could not transfer artifact org.apache.logging.log4j\:log4j-core\:jar\:sources\:2.23.1 from/to central (https\://repo.maven.apache.org/maven2)\: No such host is known (repo.maven.apache.org)

NOTE: This is same sync process - JAR resolves the ‘repo.maven.apache.org’ but the sources-JAR does not. :/

If I run ‘mvn dependency:sources’ from a terminal (git bash within IntelliJ) I see the source-JAR successfully downloaded.

Downloading from central: https://repo.maven.apache.org/maven2/org/apache/logging/log4j/log4j-core/2.23.1/log4j-core-2.23.1-sources.jar
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/logging/log4j/log4j-core/2.23.1/log4j-core-2.23.1-sources.jar (1.3 MB at 7.5 MB/s)

And the .lastupdated file now reflects the successful download.

#Wed May 22 13:09:49 CEST 2024
https\://repo.maven.apache.org/maven2/.lastUpdated=1716376189568

So obviously IntelliJ is doing something different here for the ‘classifier’ artifacts (sources/javadoc).
 

0

请先登录再写评论。