[ 
https://jira.codehaus.org/browse/MCOMPILER-230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=354357#comment-354357
 ] 

Jonathan Ogilvie commented on MCOMPILER-230:
--------------------------------------------

I understand the lifecycle.  I have two compiler passes on purpose.  I have an 
annotation processor that runs the first time but not the second (see <proc>).

The annotation processor is running when my server code compiles and generating 
Retrofit clients from Spring MVC annotations, but I don't want my server code 
to depend on Retrofit, so the generated code doesn't compile.  The annotation 
processor therefore throws an error, even though it works (the code is 
generated).  The generated code is compiled in another module.  But that's all 
beside the point, which is that <failOnError> is sometimes not working 
correctly.

This can be recreated with the above pom fragment by throwing an exception 
inside an annotation processor.

> failOnError doesn't work when set inside an execution
> -----------------------------------------------------
>
>                 Key: MCOMPILER-230
>                 URL: https://jira.codehaus.org/browse/MCOMPILER-230
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 3.1
>         Environment: Linux Mint 17 Cinnamon
>            Reporter: Jonathan Ogilvie
>
> I have the following plugin configuration in my pom:
> {code:xml}
> <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-compiler-plugin</artifactId>
>                 <version>${maven-compiler-plugin.version}</version>
>                 <executions>
>                         <execution>
>                           <id>annotation-processing</id>
>                           <phase>generate-sources</phase>
>                           <goals>
>                             <goal>compile</goal>
>                           </goals>
>                           <configuration>
>                             <proc>only</proc>
>                             <failOnError>false</failOnError>
>                           </configuration>
>                         </execution>
>                         <execution>
>                           <id>compile-without-generated-source</id>
>                           <phase>compile</phase>
>                           <goals>
>                             <goal>compile</goal>
>                           </goals>
>                           <configuration>
>                             
> <excludes><exclude>${project.build.dir}/generated-sources/**</exclude></excludes>
>                       <proc>none</proc>
>                           </configuration>
>                         </execution>
>                       </executions>
>                 <configuration>
>                     <source>${java.version}</source>
>                     <target>${java.version}</target>
>                     <proc>only</proc>
>                 </configuration>
>             </plugin>
> {code}
> During the first execution, the build still fails on error.  If I move 
> <failOnError> to the top-level <plugin><configuration> node or define it on 
> the command line instead, the value sticks, but then I can't enable 
> failOnError for the second execution.
> Of note:  it seems like this works if I negate the whole thing and switch the 
> place I'm overriding.  If I set it false at the top level configuration, and 
> true on an execution, I can get the desired behavior.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to