You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Benson Margulies <bi...@gmail.com> on 2010/02/02 02:46:15 UTC

antrun plugin dependency disappearance

I think I'm hitting an known issue, but I'm stumped in working around it.

In an aggregate POM, I've got a use of the maven-antrun-plugin that
needs custom dependencies.

They are disappearing.

The reason, I suspect, is that several of the modules that the
aggregate POM aggregates are themselves using the antrun plugin, not
specifying these dependencies. I tried to get past this by hanging the
dependencies in a pluginManagment section of the profile that turns
all of this loose, but to no avail. Maven run with -X shows that they
are gone.

Is there some more reliable workaround?

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


Re: antrun plugin dependency disappearance

Posted by Wayne Fay <wa...@gmail.com>.
> In an aggregate POM, I've got a use of the maven-antrun-plugin that
> needs custom dependencies.

Yes, this is a known issue. Copy your dependencies into all uses of
m-antrun-p OR figure out which one will run first and copy them there.
The Maven classloader only pays attention to the dependencies of a
plugin the FIRST time it sees the plugin.

Wayne

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


Re: antrun plugin dependency disappearance

Posted by Benson Margulies <bi...@gmail.com>.
Anders,

Thanks very much. I was rather worried that I was missing something here.

Perhaps I'll submit a patch to antrun.

--benson


On Tue, Feb 2, 2010 at 8:29 AM, Anders Hammar <an...@hammar.net> wrote:
> Yes, that is true. The only way to go around this is to have some switch in
> the plugin which turns off execution. One example of such is the "skip"
> param of exec-maven-plugin:
> http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html#skip
>
> However, there is no such geenric param and antrun-plugin doesn't have it I
> believe.
>
> /Anders
> On Tue, Feb 2, 2010 at 14:22, Benson Margulies <bi...@gmail.com>wrote:
>
>> On Tue, Feb 2, 2010 at 8:17 AM, Anders Hammar <an...@hammar.net> wrote:
>> > If you set inherited to false, the plugin binding is only executed in the
>> > project defined.
>>
>> Yes, but if you factor to a shared parent, you have to set inherited
>> to true, or it doesn't inherit from the parent to the child, does it?
>> And then it just keeps on inheriting down. Or so I thought.
>>
>> >
>> > /Anders
>> >
>> > On Tue, Feb 2, 2010 at 14:01, Benson Margulies <bimargulies@gmail.com
>> >wrote:
>> >
>> >> Just for the record, the structure here is a bit on the baroque side.
>> >>
>> >> I have a set of top level projects. Each one inherits from a common
>> >> top-level parents.
>> >>
>> >> The projects inside them do not inherit from their corresponding
>> >> top-level parent, the inherit from a different global parent.
>> >>
>> >> Why? Because I have an antrun execution that has to happen in the
>> >> toplevel projects, and only in the toplevel projects. Thus, I can't
>> >> let the leaves inherit from the toplevel parent.
>> >>
>> >> If there is some way to condition an execution so that it only runs in
>> >> the top project, I could make this a lot simpler.
>> >>
>> >>   global-parent                             global-top-level-parent
>> >>          |                                                 |
>> >>          |                                             top-level-1
>> >>          |                                              |    |      |
>> >>          ------------------------------------------leaf1 ....
>> >>
>> >> The leaves parent from global-parent, the top levels parent from the
>> >> global-top-level-parent.
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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


Re: antrun plugin dependency disappearance

Posted by Anders Hammar <an...@hammar.net>.
Yes, that is true. The only way to go around this is to have some switch in
the plugin which turns off execution. One example of such is the "skip"
param of exec-maven-plugin:
http://mojo.codehaus.org/exec-maven-plugin/exec-mojo.html#skip

However, there is no such geenric param and antrun-plugin doesn't have it I
believe.

/Anders
On Tue, Feb 2, 2010 at 14:22, Benson Margulies <bi...@gmail.com>wrote:

> On Tue, Feb 2, 2010 at 8:17 AM, Anders Hammar <an...@hammar.net> wrote:
> > If you set inherited to false, the plugin binding is only executed in the
> > project defined.
>
> Yes, but if you factor to a shared parent, you have to set inherited
> to true, or it doesn't inherit from the parent to the child, does it?
> And then it just keeps on inheriting down. Or so I thought.
>
> >
> > /Anders
> >
> > On Tue, Feb 2, 2010 at 14:01, Benson Margulies <bimargulies@gmail.com
> >wrote:
> >
> >> Just for the record, the structure here is a bit on the baroque side.
> >>
> >> I have a set of top level projects. Each one inherits from a common
> >> top-level parents.
> >>
> >> The projects inside them do not inherit from their corresponding
> >> top-level parent, the inherit from a different global parent.
> >>
> >> Why? Because I have an antrun execution that has to happen in the
> >> toplevel projects, and only in the toplevel projects. Thus, I can't
> >> let the leaves inherit from the toplevel parent.
> >>
> >> If there is some way to condition an execution so that it only runs in
> >> the top project, I could make this a lot simpler.
> >>
> >>   global-parent                             global-top-level-parent
> >>          |                                                 |
> >>          |                                             top-level-1
> >>          |                                              |    |      |
> >>          ------------------------------------------leaf1 ....
> >>
> >> The leaves parent from global-parent, the top levels parent from the
> >> global-top-level-parent.
> >>
> >> ---------------------------------------------------------------------
> >> 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: antrun plugin dependency disappearance

Posted by Benson Margulies <bi...@gmail.com>.
On Tue, Feb 2, 2010 at 8:17 AM, Anders Hammar <an...@hammar.net> wrote:
> If you set inherited to false, the plugin binding is only executed in the
> project defined.

Yes, but if you factor to a shared parent, you have to set inherited
to true, or it doesn't inherit from the parent to the child, does it?
And then it just keeps on inheriting down. Or so I thought.

>
> /Anders
>
> On Tue, Feb 2, 2010 at 14:01, Benson Margulies <bi...@gmail.com>wrote:
>
>> Just for the record, the structure here is a bit on the baroque side.
>>
>> I have a set of top level projects. Each one inherits from a common
>> top-level parents.
>>
>> The projects inside them do not inherit from their corresponding
>> top-level parent, the inherit from a different global parent.
>>
>> Why? Because I have an antrun execution that has to happen in the
>> toplevel projects, and only in the toplevel projects. Thus, I can't
>> let the leaves inherit from the toplevel parent.
>>
>> If there is some way to condition an execution so that it only runs in
>> the top project, I could make this a lot simpler.
>>
>>   global-parent                             global-top-level-parent
>>          |                                                 |
>>          |                                             top-level-1
>>          |                                              |    |      |
>>          ------------------------------------------leaf1 ....
>>
>> The leaves parent from global-parent, the top levels parent from the
>> global-top-level-parent.
>>
>> ---------------------------------------------------------------------
>> 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: antrun plugin dependency disappearance

Posted by Anders Hammar <an...@hammar.net>.
If you set inherited to false, the plugin binding is only executed in the
project defined.

/Anders

On Tue, Feb 2, 2010 at 14:01, Benson Margulies <bi...@gmail.com>wrote:

> Just for the record, the structure here is a bit on the baroque side.
>
> I have a set of top level projects. Each one inherits from a common
> top-level parents.
>
> The projects inside them do not inherit from their corresponding
> top-level parent, the inherit from a different global parent.
>
> Why? Because I have an antrun execution that has to happen in the
> toplevel projects, and only in the toplevel projects. Thus, I can't
> let the leaves inherit from the toplevel parent.
>
> If there is some way to condition an execution so that it only runs in
> the top project, I could make this a lot simpler.
>
>   global-parent                             global-top-level-parent
>          |                                                 |
>          |                                             top-level-1
>          |                                              |    |      |
>          ------------------------------------------leaf1 ....
>
> The leaves parent from global-parent, the top levels parent from the
> global-top-level-parent.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: antrun plugin dependency disappearance

Posted by Benson Margulies <bi...@gmail.com>.
Just for the record, the structure here is a bit on the baroque side.

I have a set of top level projects. Each one inherits from a common
top-level parents.

The projects inside them do not inherit from their corresponding
top-level parent, the inherit from a different global parent.

Why? Because I have an antrun execution that has to happen in the
toplevel projects, and only in the toplevel projects. Thus, I can't
let the leaves inherit from the toplevel parent.

If there is some way to condition an execution so that it only runs in
the top project, I could make this a lot simpler.

   global-parent                             global-top-level-parent
          |                                                 |
          |                                             top-level-1
          |                                              |    |      |
          ------------------------------------------leaf1 ....

The leaves parent from global-parent, the top levels parent from the
global-top-level-parent.

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


Re: antrun plugin dependency disappearance

Posted by Brett Porter <br...@apache.org>.
On 02/02/2010, at 1:46 PM, Benson Margulies wrote:

> On Mon, Feb 1, 2010 at 9:06 PM, Brett Porter <br...@apache.org> wrote:
>> In Maven 2, only to ensure that the first plugin declaration encountered (usually by putting it in the root) contains all of the desired plugin dependencies.
> 
> It was in the root. However, since modules run first, the instance in
> a module won, so I had to put the dependencies there.

Is the root not also the parent of the module? The only reason I said root was because it should be consistently inherited into the children (Which may have to be empty, I'm not sure if the dependencies lists are correctly merged in some versions either).

It's definitely fickle - the best I've found is:
- put it in build > plugins of the topmost parent that will use it (not plugin management)
- don't add any dependency to modules that will use it, just the additional configuration / executions
- make sure it is in build, not reporting for checkstyle, etc. type plugins

Anyway, glad you got it sorted.

Cheers,
Brett

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/





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


Re: antrun plugin dependency disappearance

Posted by Benson Margulies <bi...@gmail.com>.
On Mon, Feb 1, 2010 at 9:06 PM, Brett Porter <br...@apache.org> wrote:
> In Maven 2, only to ensure that the first plugin declaration encountered (usually by putting it in the root) contains all of the desired plugin dependencies.

It was in the root. However, since modules run first, the instance in
a module won, so I had to put the dependencies there.

>
> I believe that Maven 3 has already fixed the problem.
>
> - Brett
>
> On 02/02/2010, at 12:46 PM, Benson Margulies wrote:
>
>> I think I'm hitting an known issue, but I'm stumped in working around it.
>>
>> In an aggregate POM, I've got a use of the maven-antrun-plugin that
>> needs custom dependencies.
>>
>> They are disappearing.
>>
>> The reason, I suspect, is that several of the modules that the
>> aggregate POM aggregates are themselves using the antrun plugin, not
>> specifying these dependencies. I tried to get past this by hanging the
>> dependencies in a pluginManagment section of the profile that turns
>> all of this loose, but to no avail. Maven run with -X shows that they
>> are gone.
>>
>> Is there some more reliable workaround?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>
> --
> Brett Porter
> brett@apache.org
> http://brettporter.wordpress.com/
>
>
>
>
>
> ---------------------------------------------------------------------
> 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: antrun plugin dependency disappearance

Posted by Brett Porter <br...@apache.org>.
In Maven 2, only to ensure that the first plugin declaration encountered (usually by putting it in the root) contains all of the desired plugin dependencies.

I believe that Maven 3 has already fixed the problem.

- Brett

On 02/02/2010, at 12:46 PM, Benson Margulies wrote:

> I think I'm hitting an known issue, but I'm stumped in working around it.
> 
> In an aggregate POM, I've got a use of the maven-antrun-plugin that
> needs custom dependencies.
> 
> They are disappearing.
> 
> The reason, I suspect, is that several of the modules that the
> aggregate POM aggregates are themselves using the antrun plugin, not
> specifying these dependencies. I tried to get past this by hanging the
> dependencies in a pluginManagment section of the profile that turns
> all of this loose, but to no avail. Maven run with -X shows that they
> are gone.
> 
> Is there some more reliable workaround?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

--
Brett Porter
brett@apache.org
http://brettporter.wordpress.com/





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