You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by lilyevsky <le...@yahoo.com> on 2010/12/10 17:21:59 UTC

Separate executions for maven-compiler-plugin

I need help with configuring the maven-compiler-plugin to run compiler twice,
with different set of source roots and/or different settings for
includes/excludes. Based on the documentation, it seemed to be a simple
thing to do, but somehow I cannot make it work.

It started with the other problem I had (see my other post
http://maven.40175.n5.nabble.com/Using-annotationProcessor-in-maven-compiler-plugin-td3298435.html
) . That one I got working, though it feels like magic.
Basically I have a class A.java that uses some special annotation, and I
have an annotation processor that will create another class A1.java based on
A. I also have class B.java that uses A1. Obviously the processor should do
its job before the main compilation. Everything worked with this simple
configuration:


                org.apache.maven.plugins
                maven-compiler-plugin
                2.3.2
                
                    1.6
                    1.6
                    
                        my_processor
                    
                
            

Except one minor annoying thing: while doing the annotation processing, it
tried to compile all classes, including B.java, which uses A1 that does not
exist yet. So it gave a message that looked like an error, but it was not a
stopper for the further processing.
So I thought that in some other situation it may become critical, and I
wanted to solve this problem. I actually need to run the compiler two times: 
1. Do annotation processing, by setting proc=only, and compile only A.java,
with B.java excluded.
2. Compile everything, including A1.java (which is sitting in a different
tree "target/generated-sources/annotations"), and B.java.

I know that I need to define separate executions, and the manual says that I
can configure "default-compile" execution. I tried various configurations,
but could not make it work: the default-compile execution could not see the
"target/generated-sources/annotations" root, no matter what I tried.

I would really appreciate if somebody can give me an example of how this is
done.
-- 
View this message in context: http://maven.40175.n5.nabble.com/Separate-executions-for-maven-compiler-plugin-tp3300553p3300553.html
Sent from the Maven - Users mailing list archive at Nabble.com.