Maven debug log

The company's network has limitations, and it needs to access the Internet through a proxy. Some websites can be accessed, and some cannot be accessed. Fortunately, http://repo.maven.apache.org/ can still be used. The problem of proxy access can be solved through settings.xml,

but problem comes Now, a big site like spring.io can't go up, and many dependencies can't come down. Although the repo.maven website also has it, but spring is specified in the pom file, you can't change the pom, isn't that exhausting?

1. So I thought of a way to see if I could use mirror instead of the repository (in the profile).
2. At first, I thought that jdk would not need to be configured, so I only configured a simple repository in the profiles. The ID still needs to be configured:
<profiles>
  <profile>
  <id>jdk-1.8</id>

<activation>
<jdk>1.8</jdk>
</activation>
  <repositories>
  <repository>
  <id>springio</id >
        <url>http://repo.spring.io/libs-release/</url>
  </repository>
  </repositories>
  </profile>




    <id>springio</id>
    <mirrorOf>springio</mirrorOf>
    <url>http://repo.maven.apache.org/maven2/</url>
</mirror>
    </mirror> 
  </mirrors>
like this That ’s it, the dependencies will be downloaded immediately. After mvn opens -X, it will prompt:
[DEBUG] Using mirror springio (http://repo.maven.apache.org/maven2/) for springio (http://repo. spring.io/libs-release/).

3. I haven’t been happy for too long, and I failed again. Look at the log. It turns out that when building, the search for dependent packages still failed, but it was still the springio website. , so try adding all matches under mirror:
<mirror> 
        <id>mirrorId</id> 
        <mirrorOf>*</mirrorOf> 
        <url>http://repo.maven.apache.org/maven2/</url> 
< /mirror> 

4. Haha, it was successful. It seems that there may be some problems with maven's mirror replacement mechanism.

5. Things are not always smooth sailing.

Downloading: http://repo.maven.apache.org/maven2/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.pom
Downloaded: http://repo.maven.apache.org/maven2/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.pom (2 KB at 0.8 KB/sec)
Downloading: http://repo.maven.apache.org/maven2/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.jar
[WARNING] Checksum validation failed, expected db28774f477f07220eac18d5ec9c4e01f48589d7 but is 3723a1d9d038a7d0c62dcd005e750da3887e5580 for http://repo.maven.apache.org/maven2/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.jar
[WARNING] Checksum validation failed, expected db28774f477f07220eac18d5ec9c4e01f48589d7 but is 3723a1d9d038a7d0c62dcd005e750da3887e5580 for
http://repo.maven.apache.org/maven2/org/aspectj/aspectjweaver/1.8.9/specta repo.maven.apache.org/maven2/org/aspectj/aspectjweaver/1.8.9/aspectjweaver-1.8.9.jar (167 B at 0.4 KB/sec)


6. Here, the downloaded jar package is completely wrong, pom The file is correct, the error is that the checksum file has a problem, and stackoverflow has the same answer:
add the -DcreateChecksum=true parameter to mvn clean install

. The .threads=1
part still fails, but there are very few, first download it manually

8, OK, Build is successful

-----------------
When I tried jfinal cms recently, I found commons -io did not download successfully, prompting

Number of foreign imports: 1
import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

-----------------------------------------------------

        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:130)
        ... 20 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/io/input/XmlStreamReader


I went to repo.maven.apache.org/maven2 and found that commons-io only has version 1.3.2, while jfinal cms uses version 2.2. After reading it, the original maven resource website has a new address, settings under .m2. xml
can be changed to repo1.maven.apache.org/maven2.

If error is still reported, delete the local commons-io\commons-io\2.2 directory and update it again.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327042671&siteId=291194637