You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Thierry Lach <th...@gmail.com> on 2007/01/11 19:42:38 UTC

How to get plugin mojo to run without using in pom?

Warning - m2 programming noobie here.

I'm trying to write a mojo that will execute when maven runs anytime the
plugin is referenced, without adding the executions.

In other words, I want the pom to be:

      <plugin>
        <groupId>org.example.maven</groupId>
        <artifactId>maven-businessrules-plugin</artifactId>
      </plugin>
    </plugins>

instead of

      <plugin>
        <groupId>org.example.maven</groupId>
        <artifactId>maven-businessrules-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>rule1</goal>
              <goal>rule2</goal>
              <goal>rule3</goal>
              <goal>rule4</goal>
              <goal>rule5</goal>
              <goal>rule6</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>


and let the plugin itself figure out which rules to execute during which
phases.

I've tried a number of different combinations of @goal, @phase and @execute,
also different combinations of @execute parameters, but haven't had any luck
yet.

Can this even be done?

Thanks in advance.

Re: How to get plugin mojo to run without using in pom?

Posted by kovalen pechaycaren <ko...@gmail.com>.
Maybe this could be helpful:
http://www.nabble.com/maven-plugin-execution-phase%3A-post-site--tf2513362.html#a7014966

Kovalen

Re: How to get plugin mojo to run without using in pom?

Posted by drekka <de...@aegeon.com.au>.
Hi, I got into this as well a few weeks ago. The answer is that you have to
have a parent pom where you declare the plugin and it's executions. Inside
that you have two choices:

1. Declare the plugin (and executions) as per normal. Then when executing
any derived poms, the pluglin will be automatically called at the right
time. You do not need to re-declare it at all. 

-or- 

2. Declare the plugin and executions in a <pluginManagement> section which
means it is available but not automatically run. To then get it run in a
derived pom, you only need to include the plugin declaration with the group
and artifact ids as you want to do. 

It really depends on how you want to activate the plugin. 

Hope this helps,
Derek.


Thierry Lach-2 wrote:
> 
> Warning - m2 programming noobie here.
> 
> I'm trying to write a mojo that will execute when maven runs anytime the
> plugin is referenced, without adding the executions.
> 
> In other words, I want the pom to be:
> 
>       <plugin>
>         <groupId>org.example.maven</groupId>
>         <artifactId>maven-businessrules-plugin</artifactId>
>       </plugin>
>     </plugins>
> 
> instead of
> 
>       <plugin>
>         <groupId>org.example.maven</groupId>
>         <artifactId>maven-businessrules-plugin</artifactId>
>         <executions>
>           <execution>
>             <goals>
>               <goal>rule1</goal>
>               <goal>rule2</goal>
>               <goal>rule3</goal>
>               <goal>rule4</goal>
>               <goal>rule5</goal>
>               <goal>rule6</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
> 
> 
> and let the plugin itself figure out which rules to execute during which
> phases.
> 
> I've tried a number of different combinations of @goal, @phase and
> @execute,
> also different combinations of @execute parameters, but haven't had any
> luck
> yet.
> 
> Can this even be done?
> 
> Thanks in advance.
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-get-plugin-mojo-to-run-without-using-%3Cexecutions%3E-in-pom--tf2960870s177.html#a8292154
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org