You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tim Kettler <ti...@udo.edu> on 2007/10/01 13:05:53 UTC

Re: Optional Mojo Execution?

Hi,

Manos Batsis schrieb:
> 
> Suppose i bundle several mojos under one plugin artifactId, how can i 
> make their execution optional? In other words, I only want to run a 
> specific mojo when there is an execution element is present for it's 
> goal in the plugin configuration.

Isn't that the default behaviour? You may want to look at the sources of 
the dependency- or assembly-plugin, both contain multiple mojo's and 
only those you specify in an execution element will be invoked.

> Many thanks,
> 
> Manos

-Tim

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


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


Re: Optional Mojo Execution?

Posted by Manos Batsis <ma...@geekologue.com>.
Manos Batsis wrote:
>> The proper way of excluding certain reports from rendering is however, 
>> to specify a <reportSet> configuration in the plugin configuration. 
>> See the example in the project-info-reports [2].
> 
> I was looking at exactly this about an hour ago and, going over the xref 
> pages, could not figure out how the implementation for the reportSet 
> works (or even where it is); is this something i have to implement by 
> myself or...?


Turns out the <reportSet> configuration implementation exists within 
Maven [1], so I tried it out and it just works out of the box for my 
report plugins :-)

Many thanks Tim.

[1] 
http://maven.apache.org/ref/current/maven-model/apidocs/org/apache/maven/model/ReportSet.html

Cheers,

Manos




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


Re: Optional Mojo Execution?

Posted by Manos Batsis <ma...@geekologue.com>.
Hello Tim,

Many thanks for your email.

Tim Kettler wrote:
> Ah, it wasn't clear from you original mail that you are talking about 
> report plugins.

Yeah sorry about that :-/


> The proper way of excluding certain reports from rendering is however, 
> to specify a <reportSet> configuration in the plugin configuration. See 
> the example in the project-info-reports [2].

I was looking at exactly this about an hour ago and, going over the xref 
pages, could not figure out how the implementation for the reportSet 
works (or even where it is); is this something i have to implement by 
myself or...?


Many thanks again,

Manos

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


Re: Optional Mojo Execution?

Posted by Tim Kettler <ti...@udo.edu>.
Ah, it wasn't clear from you original mail that you are talking about 
report plugins.

Manos Batsis schrieb:
> Manos Batsis wrote:
>> According to the documentation, this seems irrelevant to my original 
>> question, which is, how to make reporting mojo execution optional, 
>> i.e. not happen unless the user specifies an execution for it.
> 
> Maybe i need to override canGenerateReport[1] for this and try to figure 
> out if an execution exists from there?

canGenerateReport() is meant to give feedback if a report is able to 
render itself in the current context. The reports that can not render 
themself are filtered out here [1] in filterReports(). So yes, you can 
use it to  disable reports.

The proper way of excluding certain reports from rendering is however, 
to specify a <reportSet> configuration in the plugin configuration. See 
the example in the project-info-reports [2].

-Tim

[1] 
https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-site-plugin/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
[2] 
http://maven.apache.org/plugins/maven-project-info-reports-plugin/examples/selective-project-info-reports.html


> [1] 
> http://maven.apache.org/ref/current/maven-reporting/maven-reporting-api/apidocs/org/apache/maven/reporting/MavenReport.html#canGenerateReport() 
> 
> 
> Thanks,
> 
> Manos
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org


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


Re: Optional Mojo Execution?

Posted by Manos Batsis <ma...@geekologue.com>.
Manos Batsis wrote:
> According to the documentation, this seems irrelevant to my original 
> question, which is, how to make reporting mojo execution optional, i.e. 
> not happen unless the user specifies an execution for it.

Maybe i need to override canGenerateReport[1] for this and try to figure 
out if an execution exists from there?

[1] 
http://maven.apache.org/ref/current/maven-reporting/maven-reporting-api/apidocs/org/apache/maven/reporting/MavenReport.html#canGenerateReport()

Thanks,

Manos

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


Re: Optional Mojo Execution?

Posted by Manos Batsis <ma...@geekologue.com>.
Manos Batsis wrote:
>>> Suppose i bundle several mojos under one plugin artifactId, how can i 
>>> make their execution optional? In other words, I only want to run a 
>>> specific mojo when there is an execution element is present for it's 
>>> goal in the plugin configuration.
>>
>> Isn't that the default behaviour? You may want to look at the sources 
>> of the dependency- or assembly-plugin, both contain multiple mojo's 
>> and only those you specify in an execution element will be invoked.
> 
> I still cannot figure it out (or how much of it applies to Reporting 
> mojos). Can someone please explain the difference, if any, between
> 
> 
> /* @goal foo
>  * @phase site
>  */
> 
> and
> 
> /* @goal foo
>  * @execute phase="site"
>  */

According to the documentation, this seems irrelevant to my original 
question, which is, how to make reporting mojo execution optional, i.e. 
not happen unless the user specifies an execution for it.

Thanks for your help,

Manos

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


Re: Optional Mojo Execution?

Posted by Manos Batsis <ma...@geekologue.com>.
Tim Kettler wrote:
> Hi,
> 
> Manos Batsis schrieb:
>>
>> Suppose i bundle several mojos under one plugin artifactId, how can i 
>> make their execution optional? In other words, I only want to run a 
>> specific mojo when there is an execution element is present for it's 
>> goal in the plugin configuration.
> 
> Isn't that the default behaviour? You may want to look at the sources of 
> the dependency- or assembly-plugin, both contain multiple mojo's and 
> only those you specify in an execution element will be invoked.

I still cannot figure it out (or how much of it applies to Reporting 
mojos). Can someone please explain the difference, if any, between


/* @goal foo
  * @phase site
  */

and

/* @goal foo
  * @execute phase="site"
  */


??

Many thanks,

Manos



> 
>> Many thanks,
>>
>> Manos
> 
> -Tim
> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


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