使用takiri-lifecycle-plugin使maven构建增量

时间:2016-12-01 07:08:40

标签: java maven continuous-integration devops

我在多模块项目中的父takiri-lifecycle-plugin上添加了maven-complier-plugin并禁用了pom,因此会逐步构建:

       <plugins>
           <plugin>
                <groupId>io.takari.maven.plugins</groupId>
                <artifactId>takari-lifecycle-plugin</artifactId>
           </plugin>
       </plugins>

       </pluginManagement>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <skip>true</skip>
                    <skipMain>true</skipMain>
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.takari.maven.plugins</groupId>
                <artifactId>takari-lifecycle-plugin</artifactId>
                <version>1.12.2</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <compilerId>jdt</compilerId>
                            <source>1.8</source>
                            <target>1.8</target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
      </pluginManagement>

但我会再次收到以下消息:

[INFO] --- takari-lifecycle-plugin:1.12.2:compile (compile) @ infra ---
[INFO] Previous incremental build state does not exist, performing full build
[INFO] Compiling 217 sources to /home/shmulik/clients/root/java/infra/target/classes
[INFO] Compiled 217 out of 217 sources (4277 ms)

我猜,这表明它没有。我做错了吗?

1 个答案:

答案 0 :(得分:0)

由于插件已经声明它是一个生命周期,这意味着你必须像这样配置takari-lifecycle-plugin:

<build>
  <plugins>
    <plugin>
      <groupId>io.takari.maven.plugins</groupId>
      <artifactId>takari-lifecycle-plugin</artifactId>
      <extensions>true</extensions>
    </plugin>
  </plugins>
</build>

重要的部分是行<extensions>true</extensions>,否则生命周期将不会被激活。

您还可以在book of takari

中阅读