Here's another situation where I want to have a plugin call another plugin.  
Can you tell me the "right" way to accomplish this?

In our group we have a release procedure that involves a few more steps beyond 
running the release:prepare mojo.  In fact, some of the parameters into the 
release:prepare mojo are based on internal standards, so they could be computed 
automatically.  I want to create a single plugin that embodies this entire 
release process that also calls the release:prepare mojo with the correct 
parameters as part of that process.

This would be another situation where one plugin invokes another plugin.  
Obviously there is coupling there.  What is a better way to achieve this 
without that coupling (is it even possible)?  Would I create a lifecycle within 
my mojo that puts the necessary data on the bus and invokes the release:prepare 
mojo as part of that lifecycle (thinking in Maven 2.1 terms)?

..David..


-----Original Message-----
From: Kenney Westerhof [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 06, 2007 5:48 PM
To: Maven Users List
Subject: Re: calling plugin in another plugin?



Nunn, Gerald wrote:
> Jason,
> 
>> It's a bad practice, and leads to coupling between plugins which is  
>> bad. We've seen the aftermath of this happening in Maven 1.x.
> 
> Since I'm doing this already I'm curious how this could be done better and 
> accomplish my goal, I'm a relative newbie to Mojos so I'm wondering if I am 
> missing a better approach. 
> 
> In my case, I needed a plugin that can handle a WebLogic shared library. A 
> shared library is a WAR or EAR that contains many different assets including 
> JARs and in order to be able to use these in Maven I've created a plugin that 
> temporarily unpacks the shared library and installs each JAR individually 
> under a library group name. It also creates a parent POM for the library that 
> can be used to drag in all the dependencies defined by the library.
> 
> In order to do this, my plugin needs to install each file individually. 
> Rather then rewrite the install plugin, I simply use my invoker class to 
> invoke the install plugin for each file I have unpacked passing in the 
> necessary parameters to make this work.
> 
> How could I accomplish the same goal using the approach you outlined?

This is a one-time setup, and really not part of the build.
You should have had those jars in the ears/wars in a repository already.

Either create a shellscript for it, or a pom, declaring a dependency on the 
war/ear (i assume that one _is_
in a repository? if not - it shouldn't be part of the maven build lifecycle).

You use the maven-dependency-plugin to unpack the war/ear (for instance in 
generate-resources), say to
${project.build.directory}/foo/
and specify a series of executions of the install plugin (for instance in 
process-resources), each one configured
with the location a jar in ${project.build.directory}/foo/.

Anyway, this is not recommended practice, but I can see why your plugin is 
useful.
The eclipse plugin has a similar mojo, that scans an eclipse installation 
directory for plugins
and installs each plugin as a maven2 artifact in the local directory. It 
doesn't use
the install mojo, afaik, but the maven api's.
I'm assuming your plugin is similar, in that it can unpack/install wars/ears 
found in a bea weblogic installation
directory?

-- Kenney

> 
> Thanks,
> 
> Gerald

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to