当工程只有Scala文件时没有问题,然而当我同时写入java文件后发现打包文件里只有java文件的class文件,scala文件被无视了。于是引入net.alchim31.maven。
然而编译确实各种报错Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:compile
修改alchim31内容如下
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<id>compile-scala</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-compile-first</id>
<phase>compile</phase>
<goals>
<goal>add-source</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
解决问题。