Spring Maven安装或清理错误,为什么?

时间:2018-12-02 15:19:18

标签: java spring maven install

当我在春季项目中使用maven installclean时,发生以下错误。

此问题在Eclipse 2018-09版本中发生。 当我使用Eclipse光子版本时,没有发生此问题。

错误消息。

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------------<  >-----------------------------
[INFO] Building  1.0.0-BUILD-SNAPSHOT
[INFO] --------------------------------    [  war ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.442 s
[INFO] Finished at: 2018-12-02T23:32:35+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.12.4: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 from/to central (https://repo.maven.apache.org/maven2): Cannot access https://repo.maven.apache.org/maven2 with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access https://repo.maven.apache.org/maven2 using the registered transporter factories: WagonTransporterFactory: java.util.NoSuchElementException
[ERROR]       role: org.apache.maven.wagon.Wagon
[ERROR]   roleHint: https
[ERROR] ->     [ Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR]     [ Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

为什么不能伪造installclean

3 个答案:

答案 0 :(得分:0)

检查此依赖性:

<groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>

并运行:

mvn clean install

答案 1 :(得分:0)

当您使用JDK7运行Maven时,似乎会出现此问题。

它一直工作到2019年4月,但是随后由于该错误导致Maven构建失败而停止工作。

答案 2 :(得分:0)

Java 7默认使用TLS v1,因此请打开终端并运行mvn并指定TLS v1.2版本:

mvn -Dhttps.protocols=TLSv1.2 clean install

More info