[ 
https://issues.apache.org/jira/browse/MCOMPILER-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14736620#comment-14736620
 ] 

Ivan Rakov commented on MCOMPILER-97:
-------------------------------------

I have just tried to compile my annotation processor with the latest maven 
version (3.3.3), results are the same:
{code}
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] Bad service configuration file, or exception thrown while constructing 
Processor object: javax.annotation.processing.Processor: Provider 
com.devexperts.egen.processor.AutoSerializableProcessor not found
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.945 s
[INFO] Finished at: 2015-09-09T13:20:36+03:00
[INFO] Final Memory: 17M/212M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-cli) on 
project egen: Compilation failure
[ERROR] Bad service configuration file, or exception thrown while constructing 
Processor object: javax.annotation.processing.Processor: Provider 
com.devexperts.egen.processor.AutoSerializableProcessor not found
{code}
As before, workaround with <compilerArgument>-proc:none</compilerArgument> 
works.
Seems like this issue is still present.

> META-INF/services/javax.annotation.processing.Processor copied before 
> compilation and causes error
> --------------------------------------------------------------------------------------------------
>
>                 Key: MCOMPILER-97
>                 URL: https://issues.apache.org/jira/browse/MCOMPILER-97
>             Project: Maven Compiler Plugin
>          Issue Type: Bug
>    Affects Versions: 2.0.2
>         Environment: Ubuntu 8.10, JDK 6.
>            Reporter: Jesse Glick
>         Attachments: MCOMPILER-97-workaround.zip, maven-6647998-test.zip
>
>
> It is tricky to compile a Maven module which defines a (269-compliant) 
> annotation processor. If you write the code for the processor in 
> src/main/java and register it in src/main/resources, 
> META-INF/services/javax.annotation.processing.Processor is copied to 
> target/classes first, and then javac is run. But javac is given 
> target/classes in -classpath, so it tries to load the processor, which of 
> course has not been compiled yet - a chicken-and-egg problem.
> The most straightforward workaround is to specify 
> <compilerArgument>-proc:none</compilerArgument> in your POM. This will only 
> work, however, if the module does not use any annotation processors defined 
> in dependencies. If it does, there may be some other trick involving 
> -processorpath and Maven variable substitution to insert the dependency 
> classpath.
> Switching the order of resources:resources and compiler:compile would help - 
> at least a clean build would work - though it could still cause problems in 
> incremental builds. Better would be for the compiler plugin to pass 
> -processorpath based on the dependency classpath (i.e. -classpath minus 
> target/classes) when using -source 1.6 or higher.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to