scala开发环境备忘
- maven管理下java中引用scala时build配置
项目打包时,默认先编译java,再编译scala,会出现找不到scala中类的问题;可以增加以下maven插件配置,指定编译打包逻辑,但需要注意java和scala不要互相引用
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.0</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>
<configuration>
<scalaVersion>2.11.12</scalaVersion>
</configuration>
</plugin>
</plugins>
</build>

浙公网安备 33010602011771号