On Tuesday 16 December 2008 Trevor Harmon wrote:
> On Dec 16, 2008, at 10:42 AM, Martin Höller wrote:
> > You are doing it wrong. Maven has no targets like ant has. Maven has
> > lifecylces [0] which is built of phases (e.g. 'compile', package',
> > 'install'). Plugins are attached to phases and are executed whenever
> > a phase is executed.
>
> Well, without profiles, I don't know how to do it right. For example,
> I use the AntRun plugin to invoke install4j, which builds installers
> for my artifact. Binding this to the deploy phase probably makes the
> most sense, but if I do that, the deploy goal of the deploy plugin
> also runs. There's no way to tell Maven to just run the install4j stuff.

The problem is, that you are still thinking in ant tasks. Maven doesn't 
provide those tasks, it just knows about a lifecyle and its few phases.

I don't  know anything about install4j but from what you wrote it seems the 
work it does should be done in the package phase. So try to configure your 
antrun plugin to execute the install4j task in the package phase. This way 
install4j will be executed whenever it needs to, i.e. when the package 
phase or one of its successors is going to be excuted.

> If, however, I split off the install4j stuff into an "install4j"
> profile and bind it to the package phase, then I can do:
>
>    mvn -Pinstall4j package

Why would you have to use a profile for this? For attaching the antrun 
plugin to the package phase you don't have to use any profile.

> And suddenly Maven does exactly what I want: It runs install4j and
> nothing else.

If you really want maven to do only _one_ specific thing (which is most of 
the time not the common way) you can execute a single plugin goal by 
specifying just this goal, e.g. "mvn deploy:deploy-file" or "mvn 
antrun:run".

hth,
- martin

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to