You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Paul Benedict <pb...@apache.org> on 2008/12/31 07:33:01 UTC

Model Version: is it really useful?

Most of my POM files look like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" ...
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  ...
</project>

I have always found it strange that there is a modelVersion element.
What purpose does it serve that the schema location can't? It seems
like a redundancy to me.

Paul

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


Re: Model Version: is it really useful?

Posted by Brett Porter <br...@apache.org>.
I started using that in the branch from early last year that handled  
multiple model versions, using StAX, and moved some fields to  
attributes. You can find it in the maven-2.0.x-terse branch.

- Brett

On 31/12/2008, at 6:45 PM, Hervé BOUTEMY wrote:

> there is a feature in Modello since november 2006, released in 1.0- 
> alpha-13,
> to read the model version from namespace instead of model field.
> But it is only available for StAX reader, not XPP3 nor Dom4J. i  
> don't know if
> there is a precise reason why this has not been integrated into  
> Maven models.
>
> See the unit-test model [1] for such a model configuration, and the  
> reader
> generator code that does the trick [2].
>
> FYI, the version detected in the namespace has to be 4.0.0, not  
> v4_0_0: that's
> another reason to modify every pom schema location to
> http://maven.apache.org/xsd/maven-4.0.0.xsd
>
> regards,
>
> Hervé
>
> [1]
> http://fisheye.codehaus.org/browse/modello/trunk/modello-plugins/modello-plugin-stax/src/test/resources/version-in-namespace.mdo?r=trunk
>
> [2]
> http://modello.codehaus.org/modello-plugins/modello-plugin-stax/xref/org/codehaus/modello/plugin/stax/StaxReaderGenerator.html#563
>
> Le mercredi 31 décembre 2008, Paul Benedict a écrit :
>> Most of my POM files look like this:
>>
>> <project xmlns="http://maven.apache.org/POM/4.0.0" ...
>>  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/maven-v4_0_0.xsd">
>>  <modelVersion>4.0.0</modelVersion>
>>  ...
>> </project>
>>
>> I have always found it strange that there is a modelVersion element.
>> What purpose does it serve that the schema location can't? It seems
>> like a redundancy to me.
>>
>> Paul
>>
>> ---------------------------------------------------------------------
>> 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
>

--
Brett Porter
brett@apache.org
http://blogs.exist.com/bporter/


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


Re: Model Version: is it really useful?

Posted by Hervé BOUTEMY <he...@free.fr>.
there is a feature in Modello since november 2006, released in 1.0-alpha-13, 
to read the model version from namespace instead of model field.
But it is only available for StAX reader, not XPP3 nor Dom4J. i don't know if 
there is a precise reason why this has not been integrated into Maven models.

See the unit-test model [1] for such a model configuration, and the reader 
generator code that does the trick [2].

FYI, the version detected in the namespace has to be 4.0.0, not v4_0_0: that's 
another reason to modify every pom schema location to 
http://maven.apache.org/xsd/maven-4.0.0.xsd

regards,

Hervé

[1] 
http://fisheye.codehaus.org/browse/modello/trunk/modello-plugins/modello-plugin-stax/src/test/resources/version-in-namespace.mdo?r=trunk

[2] 
http://modello.codehaus.org/modello-plugins/modello-plugin-stax/xref/org/codehaus/modello/plugin/stax/StaxReaderGenerator.html#563

Le mercredi 31 décembre 2008, Paul Benedict a écrit :
> Most of my POM files look like this:
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" ...
>   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
>   <modelVersion>4.0.0</modelVersion>
>   ...
> </project>
>
> I have always found it strange that there is a modelVersion element.
> What purpose does it serve that the schema location can't? It seems
> like a redundancy to me.
>
> Paul
>
> ---------------------------------------------------------------------
> 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