您的位置:首页 > 编程语言 > Java开发

eclipse构建maven scala 项目 编译成功

2016-07-05 13:28 639 查看
一、安装eclipse scala插件

系统:win7

eclipse版本:Luna Release(4.4.0)

maven是从EclipseMarket中安装的




2. 安装m2e-scala

url是:http://alchim31.free.fr/m2e-scala/update-site/




3. 添加远程的原型或模板目录:

(1)

http://repo1.maven.org/maven2/archetype-catalog.xml




新建Archetype,因为maven默认没有Group Id: net.alchim31.maven Artifact Id: scala-archetype-simple Version:1.5



创建maven项目,选择上面那个插件就可以了





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,最后打包,妥妥滴!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  spark scala