今天在编译某个 Maven 项目的时候突然出现了 Process terminated
的错误提示,咋眼一看心生疑惑:我平时按照这样执行都好好的,为啥今天就不行了呢。
原因一
我只是很单纯地执行了个“clean”命令,怎么就被突然终止了呢?于是找到了较为完整的执行过程日志信息,如下:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 3, column 110
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.hy:hy-blogs:0.0.1-SNAPSHOT (/Users/hy/code_repository/hy-blogs/pom.xml) has 1 error
[ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 3, column 110
[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
看完这一段日志,仿佛明白了点儿什么,因为上面的日志中已经说明了是什么错误异常导致的执行“clean”被终止。重点就是这句:
[ERROR] 'packaging' with value 'jar' is invalid. Aggregator projects require 'pom' as packaging. @ line 3, column 110
大概意思就是说不能指定打包类型为 jar
,必须要指定为 pom
。于是乎,我便跟着指引,将 pom.xml 文件中的 “packaging” 配置为了 “pom”,如下:
...
<groupId>com.hy</groupId>
<artifactId>hy-blogs</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
...
原因二
当我再次执行“clean”的时候,本以为它会顺利执行完成,结果没想到还是提示 Process terminated
,这就纳闷儿了,我不是按照提示修改了,咋还会这样呢。没办法,只能继续看看日志了,日志如下:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-web:jar is missing. @ line 20, column 21
[ERROR] 'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-test:jar is missing. @ line 25, column 21
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.hy:office:0.0.1-SNAPSHOT (/Users/hy