Maven: idea cannot download the source code Issue [How to Solve]

Download the source code sources by clicking into the decompiled code file of idea.

The idea prompts an error and cannot download the source code.


mvn dependency:resolve is to resolve all dependencies of the project. Finally, it prints out the details of the resolved dependencies. Specify the optional parameter classifier = sources to try to analyze and download the corresponding dependent source code. Open teminal, execute it using the local maven, and then download it.

1 mvn dependency:resolve -Dclassifier=sources

Later, I encountered the problem that idea could not download the source code.

First confirm the file | settings | build, execution, deployment > Maven settings, Maven version is 3.8.3, configuration file is also 3.8.3, and local Maven warehouse also has settings.

Click to download the source code again, and you still can’t download it.

First, check whether the local Maven warehouse has downloaded the source code, and find a file about slf4j-api-1.7.21-sources.jar.lastupdated. This file is a record file of Maven’s failure in trying to download the slf4j API source code.

Open the file with Notepad + +. According to the contents, it seems that the failure to download is closely related to the Maven default HTTP blocker.

1 #NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice.
2 #Sun Nov 21 16:52:48 CST 2021
3 http\:// not transfer artifact org.slf4j\:slf4j-api\:jar\:sources\:1.7.21 from/to maven-default-http-blocker (http\://\: Blocked mirror for repositories\: [nexus-aliyun (http\://, default, releases)]
4 @default-maven-default-http-blocker-http\://

Check the setting.xml file, find the following related configurations, and comment out the Maven default HTTP blocker image, which prevents you from finding dependencies in Alibaba’s image library. At that time, I didn’t know what the problem was to solve. I set it up and commented it out first.

After saving, restart idea, and then you can download it. The problem is solved.

The source code files are also downloaded from the local repository.

Similar Posts: