通过maven打包时出现Spring-boot错误

时间:2018-06-10 12:19:03

标签: java spring maven spring-boot

我尝试从their docs运行Spring启动示例。这是我的pom.xml但我抓到了maven错误。我做错了什么?我试图修复java证书following the answers,但它没有帮助 我使用Ubuntu 18.04和java 10.0.1

$ mvn package
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building testSpringBoot 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-maven-plugin/2.0.2.RELEASE/spring-boot-maven-plugin-2.0.2.RELEASE.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.051 s
[INFO] Finished at: 2018-06-10T14:58:51+03:00
[INFO] Final Memory: 12M/44M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.springframework.boot:spring-boot-maven-plugin:2.0.2.RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.springframework.boot:spring-boot-maven-plugin:jar:2.0.2.RELEASE: Could not transfer artifact org.springframework.boot:spring-boot-maven-plugin:pom:2.0.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty -> [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

可以使用下一个标志而不是普通mvn package

来解决问题
mvn package -Djavax.net.ssl.trustStorePassword=changeit

1 个答案:

答案 0 :(得分:1)

只需运行命令

sudo rm /etc/ssl/certs/java/cacerts && sudo update-ca-certificates -f 

感谢them获得答案