maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <jesse.gl...@oracle.com>
Subject Re: More POM5 writing
Date Tue, 02 Aug 2011 12:00:34 GMT
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


Mime
View raw message