Maven in Idea cannot download source code

Today, when I was solving a problem, I wanted to download the source code. I suddenly found that the idea could not be downloaded. , I haven’t studied the difference between local installation and built-in before, and today I just have this opportunity to look at the problem

1. The installation location of Maven in idea

The location of maven in idea, \plugins\maven in your idea installation directory 

My local address: D:\JetBrains\IntelliJ IDEA 2023.1\plugins\maven\lib\maven3

Using the mvn command in idea will prompt that the command does not exist because Maven is not in the environment variable and can be added to the system environment variable

 

 Execute it again

2. Maven cannot download the source code

Maven cannot present the source code because it needs to be commented out in the settings used by Maven

I don't know why this configuration exists, it is said to be for safety

  <mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
    </mirror>

 Remember to restart IDEA! Otherwise, it is still the configuration before modification.

If you are using the Maven installed by yourself, you can use the following command, remember to add Maven to the Path, and it can also solve the problem of downloading the source code

mvn dependency:resolve -Dclassifier=sources

 

Guess you like

Origin blog.csdn.net/perfect2011/article/details/132145300