Scala--maven编译打包

Scala的maven项目在编译打包时,需要在项目的pom.xml文件中加入以下依赖和插件配置

    <dependencies>
        <dependency>
            <groupId>org.scala-langgroupId>
            <artifactId>scala-libraryartifactId>
            <version>2.11.8version>
        dependency>
    dependencies>


    <build>
        <plugins>
            <plugin>
                <groupId>org.scala-toolsgroupId>
                <artifactId>maven-scala-pluginartifactId>
                <version>2.15.2version>
                <executions>
                    <execution>
                        <id>scala-compile-firstid>
                        <goals>
                            <goal>compilegoal>
                        goals>
                        <configuration>
                            <includes>
                                <include>**/*.scalainclude>
                            includes>
                        configuration>
                    execution>
                    <execution>
                        <id>scala-test-compileid>
                        <goals>
                            <goal>testCompilegoal>
                        goals>
                    execution>
                executions>
            plugin>
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-compiler-pluginartifactId>
                <configuration>
                    <source>1.8source>
                    <target>1.8target>
                configuration>
            plugin>
        plugins>
    build>

注意:maven的依赖导入可能非常慢,在maven的setting.xml文件中加入如下阿里maven私服镜像地址。

     <mirror>
      <id>alimavenid>
      <mirrorOf>centralmirrorOf>
      <name>aliyun mavenname>
      <url>http://maven.aliyun.com/nexus/content/repositories/central/url>
     mirror>

你可能感兴趣的:(maven,Scala)