You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by Brett Porter <br...@apache.org> on 2004/09/20 01:48:43 UTC

modello should extend previous versions

Hi,

I've just been thinking about how we would go through the process of migrating
from one version to the next of a model, and realised that we need to have each
version extend the previous, instead of being cleanly generated.

eg. let's say the maven-eclipse-plugin mojo uses maven-model-4.0.0 (where
o.a.m.model is v4.0.0), and the project it is operating on is maven-model-4.0.1.

In m2, o.a.m.model is 4.0.1, o.a.m.model.v400 is 4.0.0.

Now, I think the mojo classloader will not like the different classes in
o.a.m.model. So the best solution here is to always put the version in the package.

Now, m2 reads in the model using v401, but needs to pass to eclipse requiring
v400 - but there is no built converter between the two and maven doesn't know
what version eclipse wants.

However, if all the v401 classes extend the v400 ones and only add changes, then
they can be downcasted and all should be well as long as the mojos don't modify
the model, which shouldn't be allowed.

The last issue is of convenience - you don't want to change your imports every
time you update your model JAR: so we generate one last extension into .model
that extends v401. Changing JAR just means recompiling.

Can anyone think of another alternative?
- Perhaps by having maven need to know what the mojo wants in terms of version?
- Perhaps we generate interfaces and refer to them and have future models
reimplement old methods to migrate fields?

I actually like the last one but haven't thought it right through. However,
extension seems natural because you are evolving version by version. 

You can introduce deprecation at a certain version as well by a tag. eg:
<version>3.0.0+</version>
<deprecated>3.1.0</deprecated>
(present in 3 and above, and deprecated in 3.1.0 and above)

<version>3.0.0-4.0.0</version>
<deprecated>3.1.0</deprecated>
(preset in 3 to 4, but not 4.1 - deprecated in 3.1 to 4)

<version>3.0.0-4.0.0</version>
ERROR: removed and never deprecated.

Thanks,
Brett

Re: modello should extend previous versions

Posted by Jason van Zyl <jv...@maven.org>.
On Sun, 2004-09-19 at 19:48, Brett Porter wrote:
> Hi,
> 
> I've just been thinking about how we would go through the process of migrating
> from one version to the next of a model, and realised that we need to have each
> version extend the previous, instead of being cleanly generated.

No, we don't need to do that.

What is of utmost importance is binary compatibility in the case of
mojos that are coded against a specific version of maven. Subclassing
doesn't buy you anything in that regard: if you remove elements or
change signatures in the model it is irrelavent whether you subclass or
not. In addition it makes the tooling harder and I think would make
things more complicated. I believe a cleanly generated model with
adapter/converters is the approach to be taken.

I also hope that buy the time the final of m2 is release that the only
subsequent changes to the model will be additions to remain backward
compatible. I think after a sufficient length of time this will be
possible. If we find a dire case where we have really botched things up
then I would like to enact a policy of "correction by addition" where we
make a new element which serves the purpose we intend and deprecate the
incorrect element over a period of years. I am hoping this doesn't
happen, but it might and we can guarantee binary compatibility and
backward compatibility by following this policy. 

Adding the notions of deprecation to modello is great, but I don't
support any of the other notions presented here.

> 
> -- 
> jvz.
> 
> Jason van Zyl
> jason@maven.org
> http://maven.apache.org
> 
> happiness is like a butterfly: the more you chase it, the more it will
> elude you, but if you turn your attention to other things, it will come
> and sit softly on your shoulder ...
> 
>  -- Thoreau 


Re: modello should extend previous versions

Posted by Emmanuel Venisse <em...@venisse.net>.
----- Original Message ----- 
From: "Brett Porter" <br...@apache.org>
To: "Maven 2 Developers List" <m2...@maven.apache.org>
Sent: Tuesday, September 21, 2004 2:42 PM
Subject: Re: modello should extend previous versions


>
> >I don't want to use '-' because some projects will use modello with -dev
> >or -SNAPSHOT version.
> >
> >
> For the model version? Do we really want that?

Not for Maven, but modello isn't only for it.

>
> But I can see this would be a wider issue in Maven.
>
> >
> >
> >I finished the modello core,  java generator plugin and xml metadata
plugin
> >I work on xpp3 reader/writer today, and commit all.
> >
> >The reader/writer will works with List/Set/Map/Properties
> >
> >For Map and Properties, we'll can choose betwwen 2 xml format :
> >- inline
> >            <properties>
> >                <key1>val1</key1>
> >                <key2>val2</key2>
> >
> >            </properties>
> >- explode
> >            <properties>
> >                <property>
> >                    <key>key1</key>
> >                    <value>val1</value>
> >                </property>
> >
> >                <property>
> >                    <key>key2</key>
> >                    <value>val2</value>
> >                </property>
> >            </properties>
> >
> >
> >
> Great... once it builds again, will you be updating
> maven-model/maven.mdo for any format changes? There is an maven.mdo.new,
> but it is quite out of date.

I'll update all at the end of the week.

>
> Thanks,
> Brett
>
>
>


Re: modello should extend previous versions

Posted by Brett Porter <br...@apache.org>.
>I don't want to use '-' because some projects will use modello with -dev
>or -SNAPSHOT version.
>  
>
For the model version? Do we really want that?

But I can see this would be a wider issue in Maven.

>
>
>I finished the modello core,  java generator plugin and xml metadata plugin
>I work on xpp3 reader/writer today, and commit all.
>
>The reader/writer will works with List/Set/Map/Properties
>
>For Map and Properties, we'll can choose betwwen 2 xml format :
>- inline
>            <properties>
>                <key1>val1</key1>
>                <key2>val2</key2>
>
>            </properties>
>- explode
>            <properties>
>                <property>
>                    <key>key1</key>
>                    <value>val1</value>
>                </property>
>
>                <property>
>                    <key>key2</key>
>                    <value>val2</value>
>                </property>
>            </properties>
>
>  
>
Great... once it builds again, will you be updating 
maven-model/maven.mdo for any format changes? There is an maven.mdo.new, 
but it is quite out of date.

Thanks,
Brett



Re: modello should extend previous versions

Posted by Emmanuel Venisse <em...@venisse.net>.
----- Original Message ----- 
From: "Brett Porter" <br...@apache.org>
To: "Maven 2 Developers List" <m2...@maven.apache.org>
Sent: Tuesday, September 21, 2004 11:38 AM
Subject: Re: modello should extend previous versions


> Emmanuel Venisse wrote:
>
> >><version>3.0.0-4.0.0</version>
> >><deprecated>3.1.0</deprecated>
> >>(preset in 3 to 4, but not 4.1 - deprecated in 3.1 to 4)
> >>
> >>
> >
> >It will be add in the new modello code. The version separator is '/'
> >
> >
> Aren't there now precedents in the java language for using - to separate
> 2 versions, and + to indicate "onwards" ?

I don't want to use '-' because some projects will use modello with -dev
or -SNAPSHOT version.

>
> >><version>3.0.0-4.0.0</version>
> >>ERROR: removed and never deprecated.
> >>
> >>
> >
> >It will be add in the new modello code.
> >
> >I'll commit the new modello implementation at the end of  the week.
> >
> >
> >
> Great. Let me know if there is anything I can do to help or if it looks
> like slipping. At the moment, I'm patching generated sources because I
> can't make modello additions (there is a bug in the current one where
> the Xpp3Writer doesn't write properties).

I finished the modello core,  java generator plugin and xml metadata plugin
I work on xpp3 reader/writer today, and commit all.

The reader/writer will works with List/Set/Map/Properties

For Map and Properties, we'll can choose betwwen 2 xml format :
- inline
            <properties>
                <key1>val1</key1>
                <key2>val2</key2>

            </properties>
- explode
            <properties>
                <property>
                    <key>key1</key>
                    <value>val1</value>
                </property>

                <property>
                    <key>key2</key>
                    <value>val2</value>
                </property>
            </properties>

Emmanuel

>
> Cheers,
> Brett
>
>


Re: modello should extend previous versions

Posted by Brett Porter <br...@apache.org>.
Emmanuel Venisse wrote:

>><version>3.0.0-4.0.0</version>
>><deprecated>3.1.0</deprecated>
>>(preset in 3 to 4, but not 4.1 - deprecated in 3.1 to 4)
>>    
>>
>
>It will be add in the new modello code. The version separator is '/'
>  
>
Aren't there now precedents in the java language for using - to separate 
2 versions, and + to indicate "onwards" ?

>><version>3.0.0-4.0.0</version>
>>ERROR: removed and never deprecated.
>>    
>>
>
>It will be add in the new modello code.
>
>I'll commit the new modello implementation at the end of  the week.
>
>  
>
Great. Let me know if there is anything I can do to help or if it looks 
like slipping. At the moment, I'm patching generated sources because I 
can't make modello additions (there is a bug in the current one where 
the Xpp3Writer doesn't write properties).

Cheers,
Brett


Re: modello should extend previous versions

Posted by Emmanuel Venisse <em...@venisse.net>.
----- Original Message ----- 
From: "Brett Porter" <br...@apache.org>
To: <m2...@maven.apache.org>
Sent: Monday, September 20, 2004 1:48 AM
Subject: modello should extend previous versions


> Hi,
>
> I've just been thinking about how we would go through the process of
migrating
> from one version to the next of a model, and realised that we need to have
each
> version extend the previous, instead of being cleanly generated.
>
> eg. let's say the maven-eclipse-plugin mojo uses maven-model-4.0.0 (where
> o.a.m.model is v4.0.0), and the project it is operating on is
maven-model-4.0.1.
>
> In m2, o.a.m.model is 4.0.1, o.a.m.model.v400 is 4.0.0.
>
> Now, I think the mojo classloader will not like the different classes in
> o.a.m.model. So the best solution here is to always put the version in the
package.
>
> Now, m2 reads in the model using v401, but needs to pass to eclipse
requiring
> v400 - but there is no built converter between the two and maven doesn't
know
> what version eclipse wants.

Trygve works on a pom converter.

>
> However, if all the v401 classes extend the v400 ones and only add
changes, then
> they can be downcasted and all should be well as long as the mojos don't
modify
> the model, which shouldn't be allowed.

I think the inheritance is a bad idea because when we have a
reimplementation we can have a same class name that refers to different
object like the Repository in V3 and V4.

>
> The last issue is of convenience - you don't want to change your imports
every
> time you update your model JAR: so we generate one last extension into
.model
> that extends v401. Changing JAR just means recompiling.
>
> Can anyone think of another alternative?
> - Perhaps by having maven need to know what the mojo wants in terms of
version?
> - Perhaps we generate interfaces and refer to them and have future models
> reimplement old methods to migrate fields?
>
> I actually like the last one but haven't thought it right through.
However,
> extension seems natural because you are evolving version by version.
>
> You can introduce deprecation at a certain version as well by a tag. eg:
> <version>3.0.0+</version>
> <deprecated>3.1.0</deprecated>
> (present in 3 and above, and deprecated in 3.1.0 and above)

It will be add in the new modello code

>
> <version>3.0.0-4.0.0</version>
> <deprecated>3.1.0</deprecated>
> (preset in 3 to 4, but not 4.1 - deprecated in 3.1 to 4)

It will be add in the new modello code. The version separator is '/'

>
> <version>3.0.0-4.0.0</version>
> ERROR: removed and never deprecated.

It will be add in the new modello code.

I'll commit the new modello implementation at the end of  the week.

Emmanuel

>
> Thanks,
> Brett
>