Because it looks for modification on modules of an unique project, the Maven Incremental Plugin takes it sens only on multi modules projects. If modification on a module is detected, the output directory is removed.
You have two way to use the plugin:
To be efficient the plugin must be executed at the beginning of the compilation phase. To achieve this, you have to add this on the parent pom of you project :
<project>
[...]
<build>
[...]
<plugins>
[...]
<plugin>
<groupId>net.java.incremental-build-plugin</groupId>
<artifactId>maven-incremental-build</artifactId>
<executions>
<execution>
<goals>
<goal>incremental-build</goal>
</goals>
</execution>
</executions>
</plugin>
[...]
</plugins>
[...]
</build>
[...]
</project>You can skip the plugin execution setting the variable noIncrementalBuild to true :
[vincent@localhost base]$ mvn compile -DnoIncrementalBuild
[...]
[INFO] ------------------------------------------------------------------------
[INFO] Building incremental-build-plugin Maven Mojo Base Test
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [incremental-build:incremental-build {execution: default}]
[INFO] Incremental build deactivated.
[INFO] ------------------------------------------------------------------------
[...]