Primary Question
What I want to do is fairly easy. Or so you would think. However, nothing is working properly.
Requirement: Using maven, compile Java 1.6 project using AspectJ compiler.
Note: Our code cannot compile with javac. That is, it fails compilation if aspects are not woven in (because we have aspects that soften exceptions).
Update 2/21/2011: There are two equally viable solutions to this (both cases use the aspectj-maven-plugin in conjuction with the maven-compiler-plugin):
- Add
<failOnError>false</failOnError>to the compiler plugin (thanks Pascal Thivent) - Add
<phase>process-sources</phase>to the aspectj compiler plugin (thanks Andrew Swan)
More info on these solutions is in the answer section. I believe solution #2 is the better approach.
Related Questions
Questions (based on failed attempts below):
- How do you get maven to run the aspectj:compile goal directly, without ever running compile:compile?
- How do you ignore the failure of compile:compile?
- How do you specify a custom compilerId that points to your own ajc compiler (that is make compile:compile use an aspectj compiler other than the plexus one)?*
Attempt 1 (fail): Specify aspectJ as the compiler for the maven-compiler-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId&