You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "James Nord (jnord)" <jn...@cisco.com> on 2013/03/14 12:58:07 UTC

prerequisites pom inheritance

Hi all,

I've just realised that the "prerequisites" section of a parent pom is not inherited by its children.

This surprised me - but it is also documented that this section doesn't inherit[1]

My question is is this intentional or an oversight?

We have a parent pom that mandates maven3 (and several plugins require it) but when used in a child with Maven2 instead of the expected nice warning:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to build project 'C:\workarea\source\foo\base\pom.xml; it requires Maven version 3.0.4
[INFO] ------------------------------------------------------------------------

I am met with

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Foo
[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error resolving version for x.y.z:threadsafety-maven-plugin': Plugin requires Maven version 3.0.4

And this error doesn't come immediately (and only appears if we have a plugin that requires 3.0.4)

I found A JIRA[2] that is closed won't fix but this the comment by Jason doesn't make sense to me


"The prerequisite tag is for ensuring a particular tool has the right environment. Not to ensure that your developers do!

This should not be inherited.

The Tools (maven plugins) needs the right environment (3.0.4+)?  We are inheriting plugins that require 3.0.4 so it is good to say this is the case is it not and do not expect that all developers need to re-add a prerequisites tag?

Or to put it another way - the build should fail fast if it is guaranteed to fail - (due to the plugin configuration/binding in the parent sub projects are guaranteed to fail - unless someone overrides many plugin versions and configuration).

Regards,

/James

[1] http://maven.apache.org/pom.html#Inheritance
[2] http://jira.codehaus.org/browse/MNG-2423

RE: prerequisites pom inheritance

Posted by "James Nord (jnord)" <jn...@cisco.com>.
Thanks Stephen,

Just to clarify the docs are correct wrt the current behaviour.

(The enforcer plugin is bound to validate - but maven has to resolve the plugins first - so it's not an immediate failure)

/James
 
> -----Original Message-----
> From: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> Sent: 14 March 2013 12:12
> To: Maven Users List
> Subject: Re: prerequisites pom inheritance
> 
> It is strange from one PoV but not so strange from another. The docs should
> probably be fixed. And if we ever do get a chance to rev up the model
> version, we should probably split it into one pre-req for inheritance and a
> separate one for consuming as a dependency and a final one (corresponding
> to the current meaning) for the pre-req to build the current project.
> 
> The field reflects the minimum version required to build the current project
> only... as such its value is probably reduced given that all maven plugins
> expose a minimum and therefore the minimum for the current project could
> be inferred from the maximum minimum of the listed plugins.... but people
> could be using antrun or other scripting features or relying on newer
> exposed properties hence the value in the pom.
> 
> Solution for now is to bind the enforcer plugin to validate :-(
> 
> 
> On 14 March 2013 11:58, James Nord (jnord) <jn...@cisco.com> wrote:
> 
> > Hi all,
> >
> > I've just realised that the "prerequisites" section of a parent pom is
> > not inherited by its children.
> >
> > This surprised me - but it is also documented that this section
> > doesn't inherit[1]
> >
> > My question is is this intentional or an oversight?
> >
> > We have a parent pom that mandates maven3 (and several plugins require
> > it) but when used in a child with Maven2 instead of the expected nice
> warning:
> >
> > [INFO] Scanning for projects...
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [ERROR] BUILD FAILURE
> > [INFO]
> > ----------------------------------------------------------------------
> > -- [INFO] Unable to build project
> > 'C:\workarea\source\foo\base\pom.xml; it requires Maven version 3.0.4
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> >
> > I am met with
> >
> > [INFO] Scanning for projects...
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO] Building Foo
> > [INFO]    task-segment: [install]
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [INFO]
> > ----------------------------------------------------------------------
> > --
> > [ERROR] BUILD ERROR
> > [INFO]
> > ----------------------------------------------------------------------
> > -- [INFO] Error resolving version for
> > x.y.z:threadsafety-maven-plugin':
> > Plugin requires Maven version 3.0.4
> >
> > And this error doesn't come immediately (and only appears if we have a
> > plugin that requires 3.0.4)
> >
> > I found A JIRA[2] that is closed won't fix but this the comment by
> > Jason doesn't make sense to me
> >
> >
> > "The prerequisite tag is for ensuring a particular tool has the right
> > environment. Not to ensure that your developers do!
> >
> > This should not be inherited.
> >
> > The Tools (maven plugins) needs the right environment (3.0.4+)?  We
> > are inheriting plugins that require 3.0.4 so it is good to say this is
> > the case is it not and do not expect that all developers need to
> > re-add a prerequisites tag?
> >
> > Or to put it another way - the build should fail fast if it is
> > guaranteed to fail - (due to the plugin configuration/binding in the
> > parent sub projects are guaranteed to fail - unless someone overrides
> > many plugin versions and configuration).
> >
> > Regards,
> >
> > /James
> >
> > [1] http://maven.apache.org/pom.html#Inheritance
> > [2] http://jira.codehaus.org/browse/MNG-2423
> >

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


Re: prerequisites pom inheritance

Posted by Stephen Connolly <st...@gmail.com>.
It is strange from one PoV but not so strange from another. The docs should
probably be fixed. And if we ever do get a chance to rev up the model
version, we should probably split it into one pre-req for inheritance and a
separate one for consuming as a dependency and a final one (corresponding
to the current meaning) for the pre-req to build the current project.

The field reflects the minimum version required to build the current
project only... as such its value is probably reduced given that all maven
plugins expose a minimum and therefore the minimum for the current project
could be inferred from the maximum minimum of the listed plugins.... but
people could be using antrun or other scripting features or relying on
newer exposed properties hence the value in the pom.

Solution for now is to bind the enforcer plugin to validate :-(


On 14 March 2013 11:58, James Nord (jnord) <jn...@cisco.com> wrote:

> Hi all,
>
> I've just realised that the "prerequisites" section of a parent pom is not
> inherited by its children.
>
> This surprised me - but it is also documented that this section doesn't
> inherit[1]
>
> My question is is this intentional or an oversight?
>
> We have a parent pom that mandates maven3 (and several plugins require it)
> but when used in a child with Maven2 instead of the expected nice warning:
>
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Unable to build project 'C:\workarea\source\foo\base\pom.xml; it
> requires Maven version 3.0.4
> [INFO]
> ------------------------------------------------------------------------
>
> I am met with
>
> [INFO] Scanning for projects...
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building Foo
> [INFO]    task-segment: [install]
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Error resolving version for x.y.z:threadsafety-maven-plugin':
> Plugin requires Maven version 3.0.4
>
> And this error doesn't come immediately (and only appears if we have a
> plugin that requires 3.0.4)
>
> I found A JIRA[2] that is closed won't fix but this the comment by Jason
> doesn't make sense to me
>
>
> "The prerequisite tag is for ensuring a particular tool has the right
> environment. Not to ensure that your developers do!
>
> This should not be inherited.
>
> The Tools (maven plugins) needs the right environment (3.0.4+)?  We are
> inheriting plugins that require 3.0.4 so it is good to say this is the case
> is it not and do not expect that all developers need to re-add a
> prerequisites tag?
>
> Or to put it another way - the build should fail fast if it is guaranteed
> to fail - (due to the plugin configuration/binding in the parent sub
> projects are guaranteed to fail - unless someone overrides many plugin
> versions and configuration).
>
> Regards,
>
> /James
>
> [1] http://maven.apache.org/pom.html#Inheritance
> [2] http://jira.codehaus.org/browse/MNG-2423
>