执行maven clean package -Dmaven.test.skip时报错的解决方法

1、通过https://start.spring.io/快速创建一个Spring工程,添加依赖包含web和actuator。默认spring版本是2.1.6

2、使用idea打开工程,添加一个rest接口方法,用来测试工程。

3、打开teminal命令窗口,执行maven clean package -Dmaven.test.skip就开始报错:

最初报错为mvn不是内部或外部命令:解决方法,配置mvn环境变量

4、接着报错信息为(该问题好像重新创建了一遍工程就好了):

Downloading from central: https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.1.6.RELEASE/spring-boot-starter-parent-2.1.6.RELEASE.pom

[ERROR] [ERROR] Some problems were encountered while processing the POMs:

[FATAL] Non-resolvable parent POM for com.geektime.spring.hello:hello-spring:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.1

.6.RELEASE from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version and 'parent.relativePath' points at no local POM @ line 5, column 10

 @

[ERROR] The build could not read 1 project -> [Help 1]

[ERROR]

[ERROR] The project com.geektime.spring.hello:hello-spring:0.0.1-SNAPSHOT (F:\ht_work\09_source\learn\2019\geektime-spring\hello-spring\pom.xml) has 1 error

[ERROR] Non-resolvable parent POM for com.geektime.spring.hello:hello-spring:0.0.1-SNAPSHOT: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom

:2.1.6.RELEASE from/to central (https://repo.maven.apache.org/maven2): Received fatal alert: protocol_version and 'parent.relativePath' points at no local POM @ line 5, column 10 -

> [Help 2]

[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/ProjectBuildingException

4、接着报了另外一个错误:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:

compile (default-compile) on project springboot: Fatal error compiling:无效的参数.......

原因是,本地默认jdk版本是1.8,mvn使用的jdk版本是1.7,应该是两者jdk版本不一致导致的吧,反正将mvn使用的jdk修改成1.8就成功打包了。

你可能感兴趣的:(执行maven clean package -Dmaven.test.skip时报错的解决方法)