2015-10-16 98 views
0

我想在Maven项目中逐步编译Scala。在Maven项目中逐步编译Scala

目前,斯卡拉编译即使没有任何的变化。

我试过scala-maven-plugin,但它似乎并没有增量工作。

的pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0"> 
    <artifactId>example</artifactId> 

    <build> 
     <plugins> 
      <plugin> 
       <artifactId>scala-maven-plugin</artifactId> 
       <configuration> 
        <recompileMode>incremental</recompileMode> 
        <scalaVersion>2.11.7</scalaVersion> 
       </configuration> 
       <executions> 
        <execution> 
         <goals> 
          <goal>compile</goal> 
         </goals> 
        </execution> 
       </executions> 
       <groupId>net.alchim31.maven</groupId> 
       <version>3.2.2</version> 
      </plugin> 
     </plugins> 
    </build> 

    <groupId>example</groupId> 

    <modelVersion>4.0.0</modelVersion> 

    <name>example</name> 

    <version>0.0-SNAPSHOT</version> 
</project> 

的src /主/阶/示例/ Foo.scala

package example 

class Foo { 
    val foo = None 
} 

Maven的版本:

$ mvn --version 
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T10:37:52-07:00) 
Maven home: /usr/share/maven3 
Java version: 1.8.0_45-internal, vendor: Oracle Corporation 
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre 
Default locale: en_US, platform encoding: UTF-8 
OS name: "linux", version: "3.13.0-65-generic", arch: "amd64", family: "unix" 

然后:

$ mvn compile 
[INFO] Scanning for projects... 
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building example 0.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ example --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory /home/paul/dev/example/src/main/resources 
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ example --- 
[INFO] No sources to compile 
[INFO] 
[INFO] --- scala-maven-plugin:3.2.2:compile (default) @ example --- 
[INFO] Using incremental compilation 
[INFO] Compiling 1 Scala source to /home/paul/dev/example/target/classes... 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 4.090 s 
[INFO] Finished at: 2015-10-15T18:22:34-07:00 
[INFO] Final Memory: 23M/412M 
[INFO] ------------------------------------------------------------------------ 
$ mvn compile 
[INFO] Scanning for projects... 
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building example 0.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ example --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory /home/paul/dev/stash-conditions-test/src/main/resources 
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ example --- 
[INFO] No sources to compile 
[INFO] 
[INFO] --- scala-maven-plugin:3.2.2:compile (default) @ example --- 
[INFO] Using incremental compilation 
[INFO] Compiling 1 Scala source to /home/paul/dev/stash-conditions-test/target/classes... 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 4.661 s 
[INFO] Finished at: 2015-10-15T18:22:39-07:00 
[INFO] Final Memory: 23M/418M 
[INFO] ------------------------------------------------------------------------ 

它编译每一次!

我怎样才能得到一个Maven项目,只有当它改变了Scala编译?

回答

相关问题