When using jenkins to build today, the following error was reported
[ERROR] Failed to execute goal on project saas20: Could not resolve dependencies for project com.ipower365.saas:saas20:war:0.0.1-SNAPSHOT: Failed to collect dependencies at com.ipower365.saas:messageserviceimpl:jar:0.0.1-SNAPSHOT -> com.ipower365.boss:nacha:jar:1.0.1: Failed to read artifact descriptor for com.ipower365.boss:nacha:jar:1.0.1: Could not transfer artifact com.ipower365.boss:nacha:pom:1.0.1 from/to central (http://repo1.maven.org/maven2/):Failed to transfer file:http://repo1.maven.org/maven2/com/ipower365/boss/nacha/1.0.1/nacha-1.0.1.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
We found that this dependent file is available in the local warehouse, but during the build process, after downloading the file in the local nexus, it will still request the file download like the central warehouse.
[echoing saas20] Downloading from central: http://repo1.maven.org/maven2/com/ipower365/boss/nacha/1.0.1/nacha-1.0.1.pom
After that, we searched for the problem based on the returned 501 error. The reference link is as follows:
https://stackoverflow.com/questions/59763531/maven-dependencies-are-failing-with-501-error
As mentioned above, since January 15, 2020, the central repository no longer supports insecure communication via pure HTTP, and requires all requests to the repository to be encrypted via HTTPS.
So we added the following configuration to the settings file that we relied on during the build process:
1
2
3
4
5
6
|
<mirror> <id>central</id> <name>Maven Repository Switchboard</name> <url>https: //repo1.maven.org/maven2/</url> <mirrorOf>central</mirrorOf> </mirror> |
But the problem is still not resolved, and then an error is reported, the error is as follows:
Could not transfer artifact com.ipower365.boss:nacha:pom:1.0.1 from/to central (https://repo1.maven.org/maven2/):Received fatal alert: protocol_version -> [Help 1]
This is when using the https protocol to request the central warehouse, the protocol version needs to be specified, and then the following parameters are added when building, the reference link is as follows:
1
|
-Dhttps.protocols=TLSv1. 2 |
Then when you build again, the request is passed!
Reason: Our Java environment uses 7 and 8, while our mvn version uses 3.5.x.
Therefore, when using mvn packaging in the JAVA8 environment, the above parameters do not need to be specified, but when using the JAVA7 environment, the above error will occur. Later, we will consider updating the version of mvn and unified JAVA environment
Read More:
- How to Solve Maven Error: Failure to transfer com.thoughtworks.xstream:xstream:jar:1.3.1 from https://repo.maven.ap
- How to Solve Namedparameterjdbctemplate.queryforobject() Return Error
- How to Fix “Microsoft Visual C ++ 14.0 is required” Error
- IdentityServer4 Error: well-known/openid-configuration: HTTPS required
- How to Fix NSS error 12190 in curl accessing to HTTPS
- How to Solve Error: [ERROR] Error executing Maven.
- How to Solve Gazebo code 127
- IDEA: How to Solve spark source code Modified Error
- How to Solve Pandas Error: nested renamer is not supported python
- How to Fix Error return arrays must be of arraytype
- How to Solve Android wechat payment Error: error_code = -1
- [Solved] Windows Android Studio Cannot Start Error: Internal error. Please refer to https://code.google.com/p/android/issue
- Springboot package error: failed to execute goal org.apache.maven.plugins:maven-resources-plugin: 3.2.0…
- How to Solve HBase error: region is not online
- [Solved] presto Compile Error: Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.0.0:check
- How to Solve Error: “initializer element is not constant”
- Error: env [NODE_ENV] is not set (How to Solve)
- How to Solve Project Upgrade to flutter2.5.0 Error
- How to Solve Error: homebrew-core is a shallow clone.
- How to Solve Cocos creator label text is too many error