Hi,

I have 3 MOJOs in a single maven plugin. Each MOJO needs to be executed during specific build phases. What is the best way to make this possible, without forcing users of the plugin to insert explicit executions into their pom.xml ?

i.e. is it possible to make the following configuration by doing it programitcally in the plugin itself?
<executions>
                    <execution>
                        <id>1</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>first</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>2</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>second</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>3</id>
                        <phase>test</phase>
                        <goals>
                            <goal>third</goal>
                        </goals>
                    </execution>
</executions>

this will result in: process-sources plugin:first process-test-classes plugin:second test plugin:third
being run whenever the test phase is called.

I have used the @phase <phaseName> annotation in each MOJO. These seem to get ignored however if the goal is not called directly?

Please let me know if you require further information regarding this.

Cheers,
Nick

Reply via email to