原文连接:
Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:testCompile问题解决
解决方法4
scala项目maven的编译打包
有可能会遇到:
[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.0:compi
le (default) on project iteblog: wrap: org.apache.commons.exec.ExecuteException:
Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
原因是mvn clean package默认只处理java源代码的编译、打包,而不管scala,所以编译时遇到Hello这个由scala语言编写的class,此时scala还没编译生成class,所以找不到相应的调用入口。
解决办法:
mvn clean scala:compile compile package
如上,在compile前加入scala:compile,这是maven-scala-plugin插件提供的选项,表示编译scala,这样一来,先编译scala,再编译java,最后打包,妥妥滴!
命令行执行:
mvn clean scala:compile compile package