You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jesse Glick <je...@oracle.com> on 2011/08/02 14:00:34 UTC

Re: More POM5 writing

On 07/31/2011 05:12 PM, Benson Margulies wrote:
> https://cwiki.apache.org/confluence/display/MAVEN/Moving+forward+with+the+POM+data+model

"It would [...] be a bad idea to try to use namespaces as a versioning technique." - if you want to allow Schema validation of the entire POM, I think you have to do 
this. Otherwise you cannot add new (optional) elements - lest older versions of Maven or plugins be confused by them - or remove obsolete elements - lest older POMs 
suddenly fail to validate. Code building a model from a range of versioned namespaces could choose to have a single model for all of them, if the differences are minor 
and easily dealt with in small if-then blocks, or could define new models for major revisions; this is awkward but probably no worse than handling "undeclared" changes to 
an existing schema.

Anyway having to type <modelVersion>4.0.0</modelVersion> is no better than xmlns="http://maven.apache.org/POM/4.0.0", I think. At least the latter means that a 
Schema-aware XML editor/IDE can assist you.

What _is_ bad in Maven currently (at least as of 3.0.3) is that whereas modelVersion is required, you are permitted to write the POM with no namespace declaration at all. 
This means that any code inspecting or modifying a POM has to have a (rarely used) code branch to deal with no-namespace elements, which is cumbersome.

Worse, Maven seems to have a different idea of what valid content is than the schema says. For example, the schema says <xs:element name="modelVersion" minOccurs="0" ...> 
but Maven will report "'modelVersion' is missing." as a fatal error. Certainly there will be some semantic constraints that XML Schema cannot capture - e.g. <groupId> can 
be omitted from <project> if <parent> specifies it - but these ought to be minimized.


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


Re: More POM5 writing

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

I don't agree with your analysis.

My view is as follows:

1) POM5 should have strategically located xs:any and xs:anyAttribute
elements that give tools fair warning of future extensions. I wish
POM4 had them, but such is life. As things are, the community seems in
general to be comfortable with a small risk of breaking some fragile
tools by making small changes to POM4.

2) Adding explicit elements next to xs:any is a far more user-friendly
extensibility mechanism than creating a hodgepodge of namespaces and
prefixes.

3) I understand the theoretical advantage in correctness of changing
the schema URI for each new version, but I question the practical
utility. I can't think of a use case in which it actually helps
anything.

--benson


On Tue, Aug 2, 2011 at 8:00 AM, Jesse Glick <je...@oracle.com> wrote:
> On 07/31/2011 05:12 PM, Benson Margulies wrote:
>>
>>
>> https://cwiki.apache.org/confluence/display/MAVEN/Moving+forward+with+the+POM+data+model
>
> "It would [...] be a bad idea to try to use namespaces as a versioning
> technique." - if you want to allow Schema validation of the entire POM, I
> think you have to do this. Otherwise you cannot add new (optional) elements
> - lest older versions of Maven or plugins be confused by them - or remove
> obsolete elements - lest older POMs suddenly fail to validate. Code building
> a model from a range of versioned namespaces could choose to have a single
> model for all of them, if the differences are minor and easily dealt with in
> small if-then blocks, or could define new models for major revisions; this
> is awkward but probably no worse than handling "undeclared" changes to an
> existing schema.
>
> Anyway having to type <modelVersion>4.0.0</modelVersion> is no better than
> xmlns="http://maven.apache.org/POM/4.0.0", I think. At least the latter
> means that a Schema-aware XML editor/IDE can assist you.
>
> What _is_ bad in Maven currently (at least as of 3.0.3) is that whereas
> modelVersion is required, you are permitted to write the POM with no
> namespace declaration at all. This means that any code inspecting or
> modifying a POM has to have a (rarely used) code branch to deal with
> no-namespace elements, which is cumbersome.
>
> Worse, Maven seems to have a different idea of what valid content is than
> the schema says. For example, the schema says <xs:element
> name="modelVersion" minOccurs="0" ...> but Maven will report "'modelVersion'
> is missing." as a fatal error. Certainly there will be some semantic
> constraints that XML Schema cannot capture - e.g. <groupId> can be omitted
> from <project> if <parent> specifies it - but these ought to be minimized.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

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


Re: More POM5 writing

Posted by Arnaud Héritier <ah...@gmail.com>.
I let you see that with Jason but I think he had some motivations he
explained few months ago.
(Yes without modello, plexus, aether, sisu, Apache Maven is an empty shell
but it is like this for years as many of these projects were hosted
previously on codehaus and now are on Github or Eclipse ...)

Arnaud

On Tue, Aug 2, 2011 at 3:36 PM, Mark Struberg <st...@yahoo.de> wrote:

> that's bad news. Why not pull them back?
> codehaus has a nice git hosting service too...
>
> I don't like to get another area of troubles...
>
> LieGrue,
> strub
>
> --- On Tue, 8/2/11, Arnaud Héritier <ah...@gmail.com> wrote:
>
> > From: Arnaud Héritier <ah...@gmail.com>
> > Subject: Re: More POM5 writing
> > To: "Maven Developers List" <de...@maven.apache.org>
> > Date: Tuesday, August 2, 2011, 1:32 PM
> > No Jason moved it some months ago
> > with plexus(*) to sonatype github account
> > I think that codehaus SCM is closed (RO) for these
> > projects.
> >
> > Arnaud
> >
> > On Tue, Aug 2, 2011 at 2:50 PM, Mark Struberg <st...@yahoo.de>
> > wrote:
> >
> > > Just wondering about the sonatype github URL. Isn't
> > modello still a
> > > codehaus project?
> > >
> > > LieGrue,
> > > strub
> > >
> > > --- On Tue, 8/2/11, Jason van Zyl <ja...@sonatype.com>
> > wrote:
> > >
> > > > From: Jason van Zyl <ja...@sonatype.com>
> > > > Subject: Re: More POM5 writing
> > > > To: "Maven Developers List" <de...@maven.apache.org>
> > > > Date: Tuesday, August 2, 2011, 12:39 PM
> > > >
> > > > On Aug 2, 2011, at 8:00 AM, Jesse Glick wrote:
> > > >
> > > > > Worse, Maven seems to have a different idea
> > of what
> > > > valid content is than the schema says. For
> > example, the
> > > > schema says <xs:element name="modelVersion"
> > minOccurs="0"
> > > > ...> but Maven will report "'modelVersion' is
> > missing."
> > > > as a fatal error. Certainly there will be some
> > semantic
> > > > constraints that XML Schema cannot capture -
> > e.g.
> > > > <groupId> can be omitted from
> > <project> if
> > > > <parent> specifies it - but these ought to
> > be
> > > > minimized.
> > > > >
> > > >
> > > > The schema is being generated from the Modello
> > model so if
> > > > you see things that are incorrect then you
> > probably need to
> > > > fix them in the Modello XSD plugin[1]
> > > >
> > > > [1]:
> > >
> https://github.com/sonatype/modello/tree/master/modello-plugins/modello-plugin-xsd
> > > >
> > > > >
> > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > > > For additional commands, e-mail: dev-help@maven.apache.org
> > > > >
> > > >
> > > > Thanks,
> > > >
> > > > Jason
> > > >
> > > >
> > ----------------------------------------------------------
> > > > Jason van Zyl
> > > > Founder,  Apache Maven
> > > > http://twitter.com/jvanzyl
> > > >
> > ---------------------------------------------------------
> > > >
> > > > First, the taking in of scattered particulars
> > under one
> > > > Idea,
> > > > so that everyone understands what is being talked
> > about ...
> > > > Second,
> > > > the separation of the Idea into parts, by
> > dividing it at
> > > > the joints,
> > > > as nature directs, not breaking any limb in half
> > as a bad
> > > > carver might.
> > > >
> > > >   -- Plato, Phaedrus (Notes on the
> > Synthesis of Form
> > > > by C. Alexander)
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: More POM5 writing

Posted by Mark Struberg <st...@yahoo.de>.
that's bad news. Why not pull them back?
codehaus has a nice git hosting service too...

I don't like to get another area of troubles...

LieGrue,
strub

--- On Tue, 8/2/11, Arnaud Héritier <ah...@gmail.com> wrote:

> From: Arnaud Héritier <ah...@gmail.com>
> Subject: Re: More POM5 writing
> To: "Maven Developers List" <de...@maven.apache.org>
> Date: Tuesday, August 2, 2011, 1:32 PM
> No Jason moved it some months ago
> with plexus(*) to sonatype github account
> I think that codehaus SCM is closed (RO) for these
> projects.
> 
> Arnaud
> 
> On Tue, Aug 2, 2011 at 2:50 PM, Mark Struberg <st...@yahoo.de>
> wrote:
> 
> > Just wondering about the sonatype github URL. Isn't
> modello still a
> > codehaus project?
> >
> > LieGrue,
> > strub
> >
> > --- On Tue, 8/2/11, Jason van Zyl <ja...@sonatype.com>
> wrote:
> >
> > > From: Jason van Zyl <ja...@sonatype.com>
> > > Subject: Re: More POM5 writing
> > > To: "Maven Developers List" <de...@maven.apache.org>
> > > Date: Tuesday, August 2, 2011, 12:39 PM
> > >
> > > On Aug 2, 2011, at 8:00 AM, Jesse Glick wrote:
> > >
> > > > Worse, Maven seems to have a different idea
> of what
> > > valid content is than the schema says. For
> example, the
> > > schema says <xs:element name="modelVersion"
> minOccurs="0"
> > > ...> but Maven will report "'modelVersion' is
> missing."
> > > as a fatal error. Certainly there will be some
> semantic
> > > constraints that XML Schema cannot capture -
> e.g.
> > > <groupId> can be omitted from
> <project> if
> > > <parent> specifies it - but these ought to
> be
> > > minimized.
> > > >
> > >
> > > The schema is being generated from the Modello
> model so if
> > > you see things that are incorrect then you
> probably need to
> > > fix them in the Modello XSD plugin[1]
> > >
> > > [1]:
> > https://github.com/sonatype/modello/tree/master/modello-plugins/modello-plugin-xsd
> > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: dev-help@maven.apache.org
> > > >
> > >
> > > Thanks,
> > >
> > > Jason
> > >
> > >
> ----------------------------------------------------------
> > > Jason van Zyl
> > > Founder,  Apache Maven
> > > http://twitter.com/jvanzyl
> > >
> ---------------------------------------------------------
> > >
> > > First, the taking in of scattered particulars
> under one
> > > Idea,
> > > so that everyone understands what is being talked
> about ...
> > > Second,
> > > the separation of the Idea into parts, by
> dividing it at
> > > the joints,
> > > as nature directs, not breaking any limb in half
> as a bad
> > > carver might.
> > >
> > >   -- Plato, Phaedrus (Notes on the
> Synthesis of Form
> > > by C. Alexander)
> > >
> > >
> > >
> > >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
> 

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


Re: More POM5 writing

Posted by Arnaud Héritier <ah...@gmail.com>.
No Jason moved it some months ago with plexus(*) to sonatype github account
I think that codehaus SCM is closed (RO) for these projects.

Arnaud

On Tue, Aug 2, 2011 at 2:50 PM, Mark Struberg <st...@yahoo.de> wrote:

> Just wondering about the sonatype github URL. Isn't modello still a
> codehaus project?
>
> LieGrue,
> strub
>
> --- On Tue, 8/2/11, Jason van Zyl <ja...@sonatype.com> wrote:
>
> > From: Jason van Zyl <ja...@sonatype.com>
> > Subject: Re: More POM5 writing
> > To: "Maven Developers List" <de...@maven.apache.org>
> > Date: Tuesday, August 2, 2011, 12:39 PM
> >
> > On Aug 2, 2011, at 8:00 AM, Jesse Glick wrote:
> >
> > > Worse, Maven seems to have a different idea of what
> > valid content is than the schema says. For example, the
> > schema says <xs:element name="modelVersion" minOccurs="0"
> > ...> but Maven will report "'modelVersion' is missing."
> > as a fatal error. Certainly there will be some semantic
> > constraints that XML Schema cannot capture - e.g.
> > <groupId> can be omitted from <project> if
> > <parent> specifies it - but these ought to be
> > minimized.
> > >
> >
> > The schema is being generated from the Modello model so if
> > you see things that are incorrect then you probably need to
> > fix them in the Modello XSD plugin[1]
> >
> > [1]:
> https://github.com/sonatype/modello/tree/master/modello-plugins/modello-plugin-xsd
> >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
> > >
> >
> > Thanks,
> >
> > Jason
> >
> > ----------------------------------------------------------
> > Jason van Zyl
> > Founder,  Apache Maven
> > http://twitter.com/jvanzyl
> > ---------------------------------------------------------
> >
> > First, the taking in of scattered particulars under one
> > Idea,
> > so that everyone understands what is being talked about ...
> > Second,
> > the separation of the Idea into parts, by dividing it at
> > the joints,
> > as nature directs, not breaking any limb in half as a bad
> > carver might.
> >
> >   -- Plato, Phaedrus (Notes on the Synthesis of Form
> > by C. Alexander)
> >
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: More POM5 writing

Posted by Mark Struberg <st...@yahoo.de>.
Just wondering about the sonatype github URL. Isn't modello still a codehaus project?

LieGrue,
strub

--- On Tue, 8/2/11, Jason van Zyl <ja...@sonatype.com> wrote:

> From: Jason van Zyl <ja...@sonatype.com>
> Subject: Re: More POM5 writing
> To: "Maven Developers List" <de...@maven.apache.org>
> Date: Tuesday, August 2, 2011, 12:39 PM
> 
> On Aug 2, 2011, at 8:00 AM, Jesse Glick wrote:
> 
> > Worse, Maven seems to have a different idea of what
> valid content is than the schema says. For example, the
> schema says <xs:element name="modelVersion" minOccurs="0"
> ...> but Maven will report "'modelVersion' is missing."
> as a fatal error. Certainly there will be some semantic
> constraints that XML Schema cannot capture - e.g.
> <groupId> can be omitted from <project> if
> <parent> specifies it - but these ought to be
> minimized.
> > 
> 
> The schema is being generated from the Modello model so if
> you see things that are incorrect then you probably need to
> fix them in the Modello XSD plugin[1]
> 
> [1]: https://github.com/sonatype/modello/tree/master/modello-plugins/modello-plugin-xsd
> 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> > 
> 
> Thanks,
> 
> Jason
> 
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> http://twitter.com/jvanzyl
> ---------------------------------------------------------
> 
> First, the taking in of scattered particulars under one
> Idea,
> so that everyone understands what is being talked about ...
> Second,
> the separation of the Idea into parts, by dividing it at
> the joints,
> as nature directs, not breaking any limb in half as a bad
> carver might.
> 
>   -- Plato, Phaedrus (Notes on the Synthesis of Form
> by C. Alexander)
> 
> 
> 
> 

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


Re: More POM5 writing

Posted by Jason van Zyl <ja...@sonatype.com>.
On Aug 2, 2011, at 8:00 AM, Jesse Glick wrote:

> Worse, Maven seems to have a different idea of what valid content is than the schema says. For example, the schema says <xs:element name="modelVersion" minOccurs="0" ...> but Maven will report "'modelVersion' is missing." as a fatal error. Certainly there will be some semantic constraints that XML Schema cannot capture - e.g. <groupId> can be omitted from <project> if <parent> specifies it - but these ought to be minimized.
> 

The schema is being generated from the Modello model so if you see things that are incorrect then you probably need to fix them in the Modello XSD plugin[1]

[1]: https://github.com/sonatype/modello/tree/master/modello-plugins/modello-plugin-xsd

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

Thanks,

Jason

----------------------------------------------------------
Jason van Zyl
Founder,  Apache Maven
http://twitter.com/jvanzyl
---------------------------------------------------------

First, the taking in of scattered particulars under one Idea,
so that everyone understands what is being talked about ... Second,
the separation of the Idea into parts, by dividing it at the joints,
as nature directs, not breaking any limb in half as a bad carver might.

  -- Plato, Phaedrus (Notes on the Synthesis of Form by C. Alexander)




Re: More POM5 writing

Posted by Benson Margulies <bi...@gmail.com>.
I see namespaces as useful in distinguishing 'core maven' content from
content for consumption by other tools, like m2e.

On Tue, Aug 2, 2011 at 7:38 PM, Jesse Glick <je...@oracle.com> wrote:
> On 08/02/2011 08:52 AM, Benson Margulies wrote:
>>
>> Adding explicit elements next to xs:any is a far more user-friendly
>> extensibility mechanism than creating a hodgepodge of namespaces and
>> prefixes.
>
> Agreed. But if ease of hand editing trumps validation and other tool
> support, do you really want to use namespaces at all?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

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


Re: More POM5 writing

Posted by Jesse Glick <je...@oracle.com>.
On 08/02/2011 08:52 AM, Benson Margulies wrote:
> Adding explicit elements next to xs:any is a far more user-friendly
> extensibility mechanism than creating a hodgepodge of namespaces and
> prefixes.

Agreed. But if ease of hand editing trumps validation and other tool support, do you really want to use namespaces at all?


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


Re: More POM5 writing

Posted by Jesse Glick <je...@oracle.com>.
On 08/02/2011 08:39 AM, Jason van Zyl wrote:
> The schema is being generated from the Modello model so if you see things that are incorrect...

For the record, XsdGenerator.java explains:

// Usually, would only do this if the field is not "required", but due to inheritance, it may be
// present, even if not here, so we need to let it slide


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