Hi,

Thank you for the reply.

I just implemented option 1 that modifies the execution plan calculation
algorithm to eliminate plugins & executions that should be skipped. Users
should pass this information as...

To skip the surefire plugin,
mvn -Dskip.plugin=org.apache.maven.plugins:maven-surefire-plugin install

and to skip the surefire plugin's ex1 execution,
mvn -Dskip.plugin=org.apache.maven.plugins:maven-surefire-plugin:ex1 install

I attached the patch to MNG-3321. Please review and apply it.

Sincere Regards,
Kalyan C. Akella

On Thu, Jan 27, 2011 at 1:31 PM, Kristian Rosenvold <
kristian.rosenv...@gmail.com> wrote:

> I think any global option for skipping a plugin should be done in the
> Execution Plan Calculation,
> where we try to build the immutable plan of the actual plugins that will be
> run.
>
> Kristian
>
>
> Den 27.01.2011 05:44, skrev Kalyan Akella:
>
>> Hi,
>>
>> I recently came across this situation in my own project where I wanted to
>> skip some plugin executions during a standard maven build. I could not
>> find
>> a straight forward way to accomplish this (as described in MNG-3321) and
>> so
>> thought of implementing this feature.
>>
>> I checked out the source yesterday and after some analysis here are my two
>> options about going to implement this feature:
>>
>> Option 1:
>>
>> 1. The DefaultLifecycleExecutionPlanCalculator<
>> http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecycleExecutionPlanCalculator.java?revision=1061589&view=markup
>> >'s
>>
>> calculateLifecycleMappings method computes the applicable executions for a
>> given life cycle phase. This method also has access to the MavenSession
>> which holds the user supplied properties. So, a property like
>> -Dskip.plugin:org.apache.maven.plugins:maven-surefire-plugin is available
>> to
>> this method.
>> 2. Line 256 of this method loops over all plugins of the current project
>> and
>> for each plugin, it extracts all the applicable executions (depending on
>> the
>> life cycle phase) and returns these executions.
>> 3. It is here that I would like to introduce this skip filtering.
>> Basically
>> consult the MavenSession for every plugin/execution and check if its
>> supposed to be skipped. If yes, then *do not* add it to the returned list
>> of
>> executions.
>>
>> Option 2:
>>
>> 1. The DefaultBuildPluginManager<
>> http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java?revision=1042237&view=markup
>> >'s
>>
>> executeMojo method executes the given MojoExecution. This method also has
>> access to the MavenSession which holds the user supplied properties.
>> 2. I can introduce a guard clause at line 73, to check against the session
>> and determine if this execution be skipped or not.
>>
>> To me both options seem viable for implementation but I might be missing
>> something. In case you prefer any specific option or if there's a simpler
>> way to do this, will you please point them out.
>>
>> Sincere Regards,
>> Kalyan C. Akella
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
> For additional commands, e-mail: dev-h...@maven.apache.org
>
>

Reply via email to