You should have two separate goals (sharing most of hte same
code/functionality though). The end user could specify one single execution
block but specifying both goals in it.

You shouldn't need to know which phase you're in. The onyl thing you're
interested in (in the goal) is the classes to process. So each of the two
goals needs to have a method returning this. Having a look at similar
plugins would give you much of the structure. E.g. the aspectj maven
plugin. Or the jboss aop plugin.

/Anders

On Fri, Mar 27, 2015 at 2:10 AM, offbynull-maven <
offbynull-ma...@offbynull.com> wrote:

> I've written a Maven plugin. When it runs, I want it to process both main
> classes and test classes. I originally thought that setting my mojo's
> defaultPhase to PROCESS_CLASSES would handle this, but I've come to find
> out that PROCESS_CLASSES is only for main classes. There seems to be
> separate phase for test classes: PROCESS_TEST_CLASSES. So, when I do mvn
> clean install, my test classes don't get instrumented but my main classes
> do.
>
> What is the proper way to have a single goal process both test classes and
> main classes? Is there a way to have two default phases? or should I have
> separate goals, one for main classes and one for test classes? or should I
> tell the user to explicitly specify two execution blocks in their pom (one
> for bound to process-classes and the other to process-test-classes -- but
> then how would I find out which phase I'm in so that I can target the
> appropriate directory)?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to