美文网首页
Java 与 Scala 使用Maven混合编译打包

Java 与 Scala 使用Maven混合编译打包

作者: kikiki5 | 来源:发表于2019-07-13 22:34 被阅读0次

    SpringBoot上使用spark的时候会遇到的混合编译问题,在java代码中打包会找不到scala定义的包,即可参考使用如下配置。

    使用配置

    <build>
            <plugins>
                <plugin>
                    <groupId>net.alchim31.maven</groupId>
                    <artifactId>scala-maven-plugin</artifactId>
                    <version>3.2.2</version>
                    <executions>
                        <execution>
                            <id>scala-compile-first</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>add-source</goal>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>scala-test-compile</id>
                            <phase>process-test-resources</phase>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
    </build>
    

    相关文章

      网友评论

          本文标题:Java 与 Scala 使用Maven混合编译打包

          本文链接:https://www.haomeiwen.com/subject/dqrvkctx.html