1

I developed my own Maven plugin and annotated its Mojo as:

@Mojo(name="bt-hello-world", defaultPhase=LifecyclePhase.COMPILE)

I use this plugin in another Maven project as:

<project ...>
    ...
    <build>
        <plugins>
            <plugin>
                <groupId>com.bt.maven.learning</groupId>
                <artifactId>app-one</artifactId>
                <version>1.0-SNAPSHOT</version>
            </plugin>
        </plugins>
    </build>
</project>

It wouldn't get executed. I then added @Execute(goal="bt-hello-world", phase=LifecyclePhase.COMPILE, lifecycle="default") to the Mojo in order to avoid using <executions>, but still doesn't work.

If I do add <executions> it does work. However, I have seen projects that use plugins without <executions> and their goals get executing.

What am I missing?

gicig
  • 334
  • 3
  • 14
  • 1
    Those other plugins are bound into life cycle of Maven or define their own life cycle which I assume your's does not... – khmarbaise Feb 22 '17 at 17:00
  • 1
    Closely related: http://stackoverflow.com/q/40599913/1743880 – Tunaki Feb 22 '17 at 17:13
  • Right. The plugin I mentioned defined its own lifecycle. Thanks. – gicig Feb 23 '17 at 08:30
  • Hi @khmarbaise, I face the exact same pb but have not defined any own lifecycle. Executing "mvn help:describe -DartifactId=scm-graph-maven-plugin -DgroupId=com.teamtter.maven -Ddetail" does give me "scm-graph:generate [...] Bound to phase: validate" but running "mvn validate" does not run my plugin. If I explicitly bind it to "validate" phase in then it's ok. I really don't know why... Can you help please ? – Francois Marot Oct 10 '17 at 15:13
  • My plugin is visible there: https://github.com/fmarot/scm-graph-maven-plugin/blob/master/pom.xml – Francois Marot Oct 10 '17 at 15:22
  • First `@Execute...` is to fork a life cycle where I have doubts you would like to do..furthermore to get a plugin bound to the life cycle you need to define execution blocks for it.... – khmarbaise Oct 11 '17 at 16:08

0 Answers0