You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Markus KARG <ma...@gmx.net> on 2009/02/23 22:19:50 UTC

[Plugin-Development] Why is my plugin not executed?

I have developed an empty plugin, that does nothing, just to learn how to do
it. It works well directly but is not executed in the default @phase?!

 

The mojo echos a message to the user, and it is annotated as "@phase
generate-resources" which seems to be done correctly as the resulting
plugin.xml contains:  <phase>generate-resources</phase>

 

I have installed the plugin in my local repository and when executing that
mojo manually (mvn myplugin:mymojo) I can see the echo message.

 

Then I bound the plugin to a sample project (that also does nothing, just an
instance of the quickstart archetype):

 

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>sample</groupId>

  <artifactId>sample</artifactId>

  <packaging>jar</packaging>

  <version>1.0-SNAPSHOT</version>

  <build>

    <plugins>

      <plugin>

        <artifactId>maven-my-plugin</artifactId>

      </plugin>

    </plugins>

  </build>

</project>

 

But when running "mvn compile", my mojo is NOT called. Why?

 

It looks like the "<phase>generate-resources</phase>" is getting ignored!

 

Using "mvn -X compile" I can see that the plugin is detected and correctly
resolved, but not executed...?!

 

...

Maven version: 2.0.10

Java version: 1.6.0_10

OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

...

[DEBUG] maven-my-plugin: resolved to version 0.1-SNAPSHOT from local
repository

...

[DEBUG] maven-my-plugin: using locally installed snapshot

[DEBUG] maven-my-plugin: using locally installed snapshot

...

 

...But no other lines containing the name of my plugin...!

 

Any help appreciated! :-)

 

Thanks

Markus