首页 » 文章 » idea 中,spring boot 2.0 ,maven版原地加入scala支持

spring boot 2.0可以支持任何语言,kotlin,java,scala,那么如何在maven项目的基础上使用scala语言呢,scala标准的编译工具是sbt,但是我们为了兼容用maven

[1]加入scala 语言依赖

<!-- https://mvnrepository.com/artifact/org.scala-lang/scala-library -->
<dependency>
    <groupId>org.scala-lang</groupId>
    <artifactId>scala-library</artifactId>
    <version>2.12.8</version>
</dependency>

[2]编译插件

<plugins>
            <!-- https://mvnrepository.com/artifact/net.alchim31.maven/scala-maven-plugin -->
            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>4.0.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>

                    </execution>
                </executions>
            </plugin>
</plugins>

[3] reimport下pom文件,右键crete ---scala class,开始scala开发吧

添加新评论