You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Mark Derricutt <ma...@smxemail.com> on 2020/01/29 21:05:41 UTC

'modelVersion' is missing.

Hey all,


Interesting - I just rebuilt my maven dev snapshot ( last build yesterday worked fine ) and now I hit:


[ERROR] Error executing Maven.
org.apache.maven.model.building.ModelBuildingException: 2 problems were encountered while building the effective model for smx3:smx3.upstream.testing.bill-of-materials:1.0.46-SNAPSHOT
[ERROR] 'modelVersion' is missing. @ com.smxemail.tiles:com.smxemail.tiles.release:2.1.71
[ERROR] 'modelVersion' is missing. @ com.smxemail.tiles:com.smxemail.tiles.enforcements:3.1.18


This looks to have been introduced/tripped by commit:

716cc1fe026618 [MNG-5669] same pom.xml is read multiple times

Interesting, it does seem I'm missing the `modelVersion` element in my maven tiles, so I'm actually fine with this blowing up as I can easily add that and rerelease our tiles.

I suspect this was from:

```
-                    modelRequest.setModelSource( new FileModelSource( pomArtifact.getFile() ) );
+                    modelRequest.setModelSource( new ArtifactModelSource( pomArtifact.getFile(),
+                                                                          pomArtifact.getGroupId(),
+                                                                          pomArtifact.getArtifactId(),
+                                                                          pomArtifact.getVersion() ) );
```

Just thought I'd query this, and maybe we can note it somewhere in some release notes or something...

Cheers,
Mark

---
"The ease with which a change can be implemented has no relevance at all to whether it is the right change for the (Java) Platform for all time." &mdash; Mark Reinhold.

**Mark Derricutt** | Senior Developer
**Phone**: +64 9 302 0515 Fax: +64 9 302 0518
**Mobile**: +64 21 562 533 Freephone: 0800 SMX SMX (769 769)
**Twitter**: @talios
**SMX Limited**: Level 10, 19 Victoria Street West, Auckland, New Zealand
**Web**: http://smxemail.com

![Cloud Email Hosting & Security](http://smxemail.com/images/smxsig.png)

Re: 'modelVersion' is missing.

Posted by Mark Derricutt <ma...@talios.com>.
On 30 Jan 2020, at 10:53, Robert Scholte wrote:

> I assume these are parent pom's right?
> Are they part of the reactor or are they poms from a remote repository?
>
> The order of resolving parents has changed a bit: it used to look in the cache based on GAV, followed by matching the path of this modelSource.
> Now it is kind of the other way around: look in cache by relativePath or read by relativePath, next match the GAV.
>
> Were these poms generated?

They're "tiles" - using our tiles-maven-plugin to provide mixin support, essentially they do get injected as parents into the model tho.

We read the tile.xml artefact we publish/manually write and inject that as parents.

https://github.com/repaint-io/maven-tiles


For now I've dropped back to pre-that commit and everything works, I'll do some further testing later on and see if things break once I add those modelVersion's into the tiles.



---
"The ease with which a change can be implemented has no relevance at all to whether it is the right change for the (Java) Platform for all time." &mdash; Mark Reinhold.

Mark Derricutt
http://www.chaliceofblood.net
http://www.theoryinpractice.net
http://twitter.com/talios
http://facebook.com/mderricutt

Re: 'modelVersion' is missing.

Posted by Robert Scholte <rf...@apache.org>.
Hi Mark,

I assume these are parent pom's right?
Are they part of the reactor or are they poms from a remote repository?

The order of resolving parents has changed a bit: it used to look in the cache based on GAV, followed by matching the path of this modelSource.
Now it is kind of the other way around: look in cache by relativePath or read by relativePath, next match the GAV.

Were these poms generated?

thanks,
Robert
On 29-1-2020 22:05:58, Mark Derricutt <ma...@smxemail.com> wrote:
Hey all,
Interesting - I just rebuilt my maven dev snapshot ( last build yesterday worked fine ) and now I hit:
[ERROR] Error executing Maven.
org.apache.maven.model.building.ModelBuildingException: 2 problems were encountered while building the effective model for smx3:smx3.upstream.testing.bill-of-materials:1.0.46-SNAPSHOT
[ERROR] 'modelVersion' is missing. @ com.smxemail.tiles:com.smxemail.tiles.release:2.1.71
[ERROR] 'modelVersion' is missing. @ com.smxemail.tiles:com.smxemail.tiles.enforcements:3.1.18
This looks to have been introduced/tripped by commit:
716cc1fe026618 [MNG-5669] same pom.xml is read multiple times
Interesting, it does seem I'm missing the modelVersion element in my maven tiles, so I'm actually fine with this blowing up as I can easily add that and rerelease our tiles.
I suspect this was from:
- modelRequest.setModelSource( new FileModelSource( pomArtifact.getFile() ) ); + modelRequest.setModelSource( new ArtifactModelSource( pomArtifact.getFile(), + pomArtifact.getGroupId(), + pomArtifact.getArtifactId(), + pomArtifact.getVersion() ) );
Just thought I'd query this, and maybe we can note it somewhere in some release notes or something...
Cheers,
Mark
"The ease with which a change can be implemented has no relevance at all to whether it is the right change for the (Java) Platform for all time." — Mark Reinhold.
Mark Derricutt | Senior Developer
Phone: +64 9 302 0515 Fax: +64 9 302 0518
Mobile: +64 21 562 533 Freephone: 0800 SMX SMX (769 769)
Twitter: @talios
SMX Limited: Level 10, 19 Victoria Street West, Auckland, New Zealand
Web: http://smxemail.com [http://smxemail.com]
[Cloud Email Hosting &amp; Security]