1.概述
scala-maven-plugin 这个插件是用来让maven能够编译、测试、运行scala项目的,
使用文档参考:scala-maven-plugin
2.使用插件
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
3.Eclipse集成安装scala-maven-plugin
m2e-scala用来支持scala开发中对maven的一些定制功能。通过eclipse的Install New Software安装。
安装过程
1、Help->Install New Software
2、url里输入http://alchim31.free.fr/m2e-scala/update-site/
勾选完点击next安装,安装完重启Eclipse。
3、运行命令行:
scala:compile compile
clean scala:compile compile
Eclipse下需要在Run As----maven build下运行
最后运行maven----update project,可以看到pom下错误消除了