maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Porter <>
Subject modello should extend previous versions
Date Sun, 19 Sep 2004 23:48:43 GMT

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:
(present in 3 and above, and deprecated in 3.1.0 and above)

(preset in 3 to 4, but not 4.1 - deprecated in 3.1 to 4)

ERROR: removed and never deprecated.


View raw message