问题描述:
java、scala混用的情况下,maven打包,遇到找不到符号的报错
原因:
若在java代码中调用了scala代码,则需先编译scala代码,后编译java代码。
解决方法(亲测):
<build><plugins><plugin><groupId>org.scala-tools</groupId><artifactId>maven-scala-plugin</artifactId><version>2.15.2</version><executions><execution><id>compile-scala</id><phase>generate-sources</phase><goals><goal>add-source</goal><goal>compile</goal></goals></execution><execution><id>test-compile-scala</id><phase>test-compile</phase><goals><goal>add-source</goal><goal>testCompile</goal></goals></execution></executions><configuration><scalaVersion>2.11.0</scalaVersion><recompileMode>incremental</recompileMode><args><arg>-unchecked</arg><arg>-deprecation</arg><arg>-feature</arg></args></configuration></plugin><plugin><groupId>net.alchim31.maven</groupId><artifactId>scala-maven-plugin</artifactId><version>3.2.2</version><executions><execution><id>compile-scala</id><phase>generate-sources</phase><goals><goal>add-source</goal><goal>compile</goal></goals></execution></executions></plugin></plugins></build>
