How do I disable the maven-compiler-plugin?

Andrew Eisenberg picture Andrew Eisenberg · Jan 30, 2013 · Viewed 12.7k times · Source

I have a maven project that uses the aspectj-compiler-plugin. I use intertype declarations so there are references to Aspect code in my Java code. Because of this, the maven-compiler-plugin fails to compile since it does not compile the aspect code.

My question is: how do I disable the maven-compiler-plugin from running because it is not doing anything useful?

There are several ways that I can get this project compiling, but they are sub-optimal:

  1. Add exclusion filters to the maven-compiler-plugin. The plugin will still run, but it will not try to compile anything. Problem is that this breaks the ajdt project configurator in Eclipse
  2. Move all java code to the aspectj folders. This doesn't feel right either.

Answer

Jintian DENG picture Jintian DENG · Jan 31, 2013

You can disable the a plugin by set the phase of the plugin to none.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
                <execution>
                    <id>default-compile</id>
                    <phase>none</phase>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>