原文链接:https://www.freesion.com/article/99081321457/
案例:本文主要描述如何解决Java+Scala通过Maven混合编译 报错【程序包不存在】
一、报错信息
Error:(2,33) java: 错误: 程序包com.mth.data.minhangk3.dao不存在
二、解决方法:在pom.xml文件中增加插件
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<!-- <scalaVersion>2.11.8</scalaVersion> -->
</configuration>
</plugin>
注:${scala.version}填写自己的Scala版本,我的是2.11.8