maven插件(3) - scala插件scala-maven-plugin

1. scala-maven-plugin

这个插件是用来让maven能够编译、测试、运行scala项目的,使用文档参考scala-maven-plugin

1. 1使用插件

在pom中加入如下配置:

<plugins>
<plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <version>2.15.2</version>
                <executions>
                    <execution>
                        <id>scala-compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                          <!--includes是一个数组,包含要编译的code-->
                            <includes>
                                <include>**/*.scala</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>scala-test-compile</id>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
</plugins>

比较常用的两个goal:

  1. compile 编译scala code
  2. testCompile 编译test code

运行命令行:

mvn clean scala:compile  compile

编译项目

    原文作者:aaron1993
    原文地址: https://www.jianshu.com/p/461671002589
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞