Reputation: 2339
I'd like my plugin to be executed in the compilation phase. But when I do it like this it fails due to "duplicate class" errors. When I run this in a different phase everything works fine. How to deal with it so that I could just swap the default maven compilation behavior with the one I've created?
Thanks!
Upvotes: 0
Views: 42
Reputation: 13988
I believe you have two options, neither of them are particularly nice.
Set the phase
of the compiler plugin to none
, which will stop it from being executed. i.e.
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
It should be noted the reason this option isn't particularly nice is that setting <phase>none</phase>
is an undocumented feature and so could be removed in a future version of maven.
Set the packaging
of your project to something other than jar
. This will then remove the default execution of the compiler plugin. But it will also remove the execution of all other plugins (i.e. resources, surefire, jar, etc) so you would have to add them back in manually.
Upvotes: 1