You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jochen Wiedmann <jo...@gmail.com> on 2010/06/16 10:20:41 UTC
Proposal: Maven launchers in the POM
Hi,
I have already posted the same suggestion on the M2Eclipse mailing
list, with very limited response, so'd like to try it once more, and
with a wider audience.
In the times when I was using "make", or "ant", there have always been
some standard targets like "all", "install", "clean" and so on. These
are perfectly met by the respective lifecycle phases, or plugins.
However, quite frequently, make or build files also used to contain
some additional targets, which have been project specific and which
have also been invoked from the command line. Ant went so far as to
show these special targets by using "ant -projecthelp".
The requirement for these things is still there. For example, I've got
a project with some 30 modules. There are exactly 3 of them, in which
I frequently do the following:
- Run "mvn dependency:copy-dependencies"
- Copy these dependencies to a particular folder
- Copy the projects jar file to the same folder
- Possible remove some jar files, which have gone from the dependency list.
Quite obviously, this would be a perfect thing for such a "special
target" like above.
I can resolve this by writing a script. But that script wouldn't be
portable, or it introduces additional dependencies on some scripting
language, or the like. Why not do it with Maven? Besides, this would
me my personal solution. A much better solution would be if Maven
itself, or at least the tools gathering around the Maven world would
know my solution? For example "mvn help:projecthelp" might show me the
special targets. So could the "Run As..." dialog in a Eclipse or
NetBeans plugin.
A Maven launcher could invoke a certain Maven goal, enabling or
disabling certain profiles. In other words, the POM entry could look
something like this:
<launcher>
<id>copy-release-dependencies</id>
<launchedItems>
<launchedLifecyclePhase>package</launchedLifecyclePhase>
<launchedPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<goal>copy-dependencies</goal>
... more properties possible here, roughly comparable
to a plugin execution
</launchedPlugin>
<launchedPlugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</launchedPlugin>
...
</launchedItems>
<enabledProfiles>
<enabledProfile>release</enabledProfile>
</enabledProfiles>
</launcher>
The idea would be that I invoke Maven roughly like "mvn -launcher
cop-release-dependencies". Maven would iterate over the list of
launched plugins and, for every such plugin, invoke itself using the
Maven embedder and call the respective goal. In other words, this
would invoke
mvn package
mvn dependency:copy-dependencies
mvn antrun:run
...
No lifecycle considerations, or stuff like that, so that the
implementation could be relatively simple.
Jochen
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Proposal: Maven launchers in the POM
Posted by Jochen Wiedmann <jo...@gmail.com>.
Yes, Milos, I can do mostly the same by creating a so-called launcher
with M2Eclipse. But that's not the point. It's a solution, which is
specific to the respective plugin. So would be my shell or whatever
script. My point is, that the requirement is there, for all of us, and
so it would make sense to have the solution in Maven, so that we can
all benefit from it.
Jochen
On Wed, Jun 16, 2010 at 10:28 AM, Milos Kleint <mk...@gmail.com> wrote:
> you can already do this with netbeans afaik.
> 1. add the configuration of plugins in a profile
> 2. in nb ui, create a custom action in project properties/Actions
> customizer.
> 3. name the action, enable the given profile and execute the goals
> 4. done, run the action from project popup. (if you want it global - for all
> projects just set in Tool/Options/Misc
>
> I'm sure the m2eclipse' configurations can do the same.
>
> Milos
>
>
> On Wed, Jun 16, 2010 at 10:20 AM, Jochen Wiedmann <jochen.wiedmann@gmail.com
>> wrote:
>
>> Hi,
>>
>> I have already posted the same suggestion on the M2Eclipse mailing
>> list, with very limited response, so'd like to try it once more, and
>> with a wider audience.
>>
>> In the times when I was using "make", or "ant", there have always been
>> some standard targets like "all", "install", "clean" and so on. These
>> are perfectly met by the respective lifecycle phases, or plugins.
>> However, quite frequently, make or build files also used to contain
>> some additional targets, which have been project specific and which
>> have also been invoked from the command line. Ant went so far as to
>> show these special targets by using "ant -projecthelp".
>>
>> The requirement for these things is still there. For example, I've got
>> a project with some 30 modules. There are exactly 3 of them, in which
>> I frequently do the following:
>>
>> - Run "mvn dependency:copy-dependencies"
>> - Copy these dependencies to a particular folder
>> - Copy the projects jar file to the same folder
>> - Possible remove some jar files, which have gone from the dependency
>> list.
>>
>> Quite obviously, this would be a perfect thing for such a "special
>> target" like above.
>>
>> I can resolve this by writing a script. But that script wouldn't be
>> portable, or it introduces additional dependencies on some scripting
>> language, or the like. Why not do it with Maven? Besides, this would
>> me my personal solution. A much better solution would be if Maven
>> itself, or at least the tools gathering around the Maven world would
>> know my solution? For example "mvn help:projecthelp" might show me the
>> special targets. So could the "Run As..." dialog in a Eclipse or
>> NetBeans plugin.
>>
>> A Maven launcher could invoke a certain Maven goal, enabling or
>> disabling certain profiles. In other words, the POM entry could look
>> something like this:
>>
>> <launcher>
>> <id>copy-release-dependencies</id>
>> <launchedItems>
>> <launchedLifecyclePhase>package</launchedLifecyclePhase>
>> <launchedPlugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-dependency-plugin</artifactId>
>> <goal>copy-dependencies</goal>
>> ... more properties possible here, roughly comparable
>> to a plugin execution
>> </launchedPlugin>
>> <launchedPlugin>
>> <groupId>org.apache.maven.plugins</groupId>
>> <artifactId>maven-antrun-plugin</artifactId>
>> </launchedPlugin>
>> ...
>> </launchedItems>
>> <enabledProfiles>
>> <enabledProfile>release</enabledProfile>
>> </enabledProfiles>
>> </launcher>
>>
>> The idea would be that I invoke Maven roughly like "mvn -launcher
>> cop-release-dependencies". Maven would iterate over the list of
>> launched plugins and, for every such plugin, invoke itself using the
>> Maven embedder and call the respective goal. In other words, this
>> would invoke
>>
>> mvn package
>> mvn dependency:copy-dependencies
>> mvn antrun:run
>> ...
>>
>> No lifecycle considerations, or stuff like that, so that the
>> implementation could be relatively simple.
>>
>>
>> Jochen
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>
--
Germanys national anthem is the most boring in the world - how telling!
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Proposal: Maven launchers in the POM
Posted by Milos Kleint <mk...@gmail.com>.
you can already do this with netbeans afaik.
1. add the configuration of plugins in a profile
2. in nb ui, create a custom action in project properties/Actions
customizer.
3. name the action, enable the given profile and execute the goals
4. done, run the action from project popup. (if you want it global - for all
projects just set in Tool/Options/Misc
I'm sure the m2eclipse' configurations can do the same.
Milos
On Wed, Jun 16, 2010 at 10:20 AM, Jochen Wiedmann <jochen.wiedmann@gmail.com
> wrote:
> Hi,
>
> I have already posted the same suggestion on the M2Eclipse mailing
> list, with very limited response, so'd like to try it once more, and
> with a wider audience.
>
> In the times when I was using "make", or "ant", there have always been
> some standard targets like "all", "install", "clean" and so on. These
> are perfectly met by the respective lifecycle phases, or plugins.
> However, quite frequently, make or build files also used to contain
> some additional targets, which have been project specific and which
> have also been invoked from the command line. Ant went so far as to
> show these special targets by using "ant -projecthelp".
>
> The requirement for these things is still there. For example, I've got
> a project with some 30 modules. There are exactly 3 of them, in which
> I frequently do the following:
>
> - Run "mvn dependency:copy-dependencies"
> - Copy these dependencies to a particular folder
> - Copy the projects jar file to the same folder
> - Possible remove some jar files, which have gone from the dependency
> list.
>
> Quite obviously, this would be a perfect thing for such a "special
> target" like above.
>
> I can resolve this by writing a script. But that script wouldn't be
> portable, or it introduces additional dependencies on some scripting
> language, or the like. Why not do it with Maven? Besides, this would
> me my personal solution. A much better solution would be if Maven
> itself, or at least the tools gathering around the Maven world would
> know my solution? For example "mvn help:projecthelp" might show me the
> special targets. So could the "Run As..." dialog in a Eclipse or
> NetBeans plugin.
>
> A Maven launcher could invoke a certain Maven goal, enabling or
> disabling certain profiles. In other words, the POM entry could look
> something like this:
>
> <launcher>
> <id>copy-release-dependencies</id>
> <launchedItems>
> <launchedLifecyclePhase>package</launchedLifecyclePhase>
> <launchedPlugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <goal>copy-dependencies</goal>
> ... more properties possible here, roughly comparable
> to a plugin execution
> </launchedPlugin>
> <launchedPlugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-antrun-plugin</artifactId>
> </launchedPlugin>
> ...
> </launchedItems>
> <enabledProfiles>
> <enabledProfile>release</enabledProfile>
> </enabledProfiles>
> </launcher>
>
> The idea would be that I invoke Maven roughly like "mvn -launcher
> cop-release-dependencies". Maven would iterate over the list of
> launched plugins and, for every such plugin, invoke itself using the
> Maven embedder and call the respective goal. In other words, this
> would invoke
>
> mvn package
> mvn dependency:copy-dependencies
> mvn antrun:run
> ...
>
> No lifecycle considerations, or stuff like that, so that the
> implementation could be relatively simple.
>
>
> Jochen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>