@Guillaume Nodet
https://github.com/XenoAmess/gop-platform-maven-structure-demo.git

Guillaume Nodet <[email protected]> 于2025年10月16日周四 13:45写道:

> That's the case anymore with Maven 4.
> The consumer POM is installed to your local repository and does not contain
> CI-friendly versions anymore.
>
> Can you set up a small project to reproduce the problem ? I don't really
> understand...
>
> Le jeu. 16 oct. 2025 à 05:05, Xeno Amess <[email protected]> a écrit :
>
> > seems nisse can also not handle this situation
> >
> > ----------------
> >
> > I know if I add this to maven 4 it can work
> >
> > Index:
> >
> >
> impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
> > IDEA additional info:
> > Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
> > <+>UTF-8
> > ===================================================================
> > diff --git
> >
> >
> a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
> >
> >
> b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
> > ---
> >
> >
> a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
> > (revision 5a33f4b24cf97bc7df5ac467b41d90c150571889)
> > +++
> >
> >
> b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
> > (date 1760427656771)
> > @@ -1219,6 +1219,11 @@
> >              String groupId = parent.getGroupId();
> >              String artifactId = parent.getArtifactId();
> >              String version = parent.getVersion();
> > +
> > +            for (Map.Entry<String, String> entry :
> > childModel.getProperties().entrySet()) {
> > +                version = version.replace("${" + entry.getKey() + "}",
> > entry.getValue());
> > +            }
> > +
> >              String classifier = parent instanceof Mixin ? ((Mixin)
> > parent).getClassifier() : null;
> >              String extension = parent instanceof Mixin ? ((Mixin)
> > parent).getExtension() : null;
> >
> >
> > but I shouldn't, because I read
> >
> >
> https://cwiki.apache.org/confluence/display/MAVENOLD/Automatic+Parent+Versioning
> > ,
> > according to it:
> >
> > When maven installs or deploys an artifact the pom is copied from the
> > source directory to the local or remote repository without modification.
> So
> > a pom that looks like
> > <project>
> > ...
> >   <groupId>org.apache.maven</groupId>
> >   <artifactId>demo</groupId>
> >   <version>${myVersion}</version>
> > </project>
> > and where myVersion is set to 1.0.0 will be deployed to
> > /org/apache/maven/demo/1.0.0/demo-1.0.0.pom and will still contain
> > ${myVersion} as the "value" of the version element. This could lead to
> the
> > odd case of a dependency being specified with 1.0.0 as the version and
> > myVersion never being specified, or worse being set to a value other than
> > 1.0.0.  If one were to assume that item 1 above was the be fixed then
> this
> > issue must also be addressed. If a project is deployed with its parent
> > version (or any of the other parent elements) set to variables then it is
> > impossible to guarantee that the build will always be reproducable since
> > the parent version variable would have to be set either in a settings
> file
> > or from the command line, neither of which can be guaranteed from one
> build
> > to the next. Worse, any project that has a dependency on such a project
> > would also have to define the variable in a settings file or on the
> command
> > line.
> >
> > I think it be correct for parent version as well, so I have to modify the
> > flatten plugin as well, thus the deployed pom be flattened.
> > Though I have to find a way to avoid abusion of this, means deploy a
> > missing-parent-version pom to central and cause unreproducable....
> >  So maybe the best choice for me is enjoy the modified maven version
> > locally by myself...for this repo at least needn't  be deployed; it just
> > need to build a docker image and we use that image in our production...
> >
> > Tamás Cservenák <[email protected]> 于2025年10月16日周四 01:57写道:
> >
> > > Howdy,
> > >
> > > And not to mention, how Nisse works with Maven 3 as well, without the
> > > need for the flatten plugin.
> > > When extension is present, version can contain ANY expression, the
> > > only requirement is to HAVE VALUE.
> > > Also, Nisse (automatically) collects properties that need inlining
> > > (user can extend configure more) and inlines them.
> > >
> > > https://github.com/maveniverse/nisse
> > >
> > > Thanks
> > > T
> > >
> > > On Wed, Oct 15, 2025 at 6:45 AM Guillaume Nodet <[email protected]>
> > wrote:
> > > >
> > > > Can't you use Maven 4, where CI-friendly properties aren't restricted
> > > > anymore and where the version for the whole reactor can be set by a
> > > > property, or even using an extension ?
> > > > JLine does that now : the property is defined by the nisse extension,
> > > > automatically computed from the git history, and defined in a single
> > > place,
> > > > in the root pom.
> > > > The children just inherit this version.
> > > >    https://github.com/jline/jline3/blob/master/pom.xml#L16
> > > >
> > > > Le mar. 14 oct. 2025 à 11:24, Xeno Amess <[email protected]> a
> > écrit :
> > > >
> > > > > I found out even if I extend the  CI-Friendly versions can't I
> find a
> > > good
> > > > > way to implement what I want, means declaring parent version from
> > > > > properties.
> > > > > If I really want it I have to modify maven to allow the pom be
> read,
> > > and
> > > > > modify flatten to flatten the version in parent, then add a
> validator
> > > for
> > > > > deploying to avoid some people pass a dynamic parent version to
> > > remote...
> > > > >
> > > > > Christoph Läubrich <[email protected]> 于2025年10月14日周二 17:06写道:
> > > > >
> > > > > > Mavens CI-Friendly versions are extensible, see for example:
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > >
> >
> https://github.com/eclipse-tycho/tycho/blob/main/tycho-build/src/main/java/org/eclipse/tycho/build/TychoCiFriendlyVersions.java
> > > > > >
> > > > > > but you need to know them by name due to how they work, so there
> > > can't
> > > > > > be a simple prefix.
> > > > > >
> > > > > >
> > > > > > Am 14.10.25 um 11:02 schrieb Xeno Amess:
> > > > > > > findout I have to modify both maven and flatten-plugin to allow
> > > modify
> > > > > > the
> > > > > > > parent, and it be hard to forbid misuse to let dynamic parent
> > > version
> > > > > by
> > > > > > > argline
> > > > > > > possibly I should find another idea to achieve this...
> > > > > > >
> > > > > > > Xeno Amess <[email protected]> 于2025年10月11日周六 17:01写道:
> > > > > > >
> > > > > > >> according to the codes we only have 3 of these properties.
> > > > > > >>
> > > > > > >> private static final String SHA1_PROPERTY = "sha1";
> > > > > > >>
> > > > > > >> private static final String CHANGELIST_PROPERTY =
> "changelist";
> > > > > > >>
> > > > > > >> private static final String REVISION_PROPERTY = "revision";
> > > > > > >>
> > > > > > >>
> > > > > > >> should we add a new set of them (likely a prefix like
> > > ci_friendly_* )
> > > > > > >>
> > > > > > >> ----------
> > > > > > >>
> > > > > > >> the reason I want it is I have several repos who both
> inherited
> > > from a
> > > > > > pom
> > > > > > >> of a version, and use a same version number elsewhere.
> > > > > > >>
> > > > > > >> for example
> > > > > > >>
> > > > > > >> we have
> > > > > > >>
> > > > > > >> <parent>
> > > > > > >>      <groupId>org.springframework.boot</groupId>
> > > > > > >>      <artifactId>spring-boot-starter-parent</artifactId>
> > > > > > >>      <version>3.5.6</version>
> > > > > > >>      <relativePath></relativePath>
> > > > > > >> </parent>
> > > > > > >>
> > > > > > >> and same time
> > > > > > >>
> > > > > > >> <properties>
> > > > > > >>      <java.version>21</java.version>
> > > > > > >>      <springboot.version>3.5.6</springboot.version>
> > > > > > >>      <revision>0.0.1</revision>
> > > > > > >>
> > > <native.maven.plugin.version>0.11.0</native.maven.plugin.version>
> > > > > > >>      <graalpy.version>25.0.0</graalpy.version>
> > > > > > >>      <antlr.version>3.5.3</antlr.version>
> > > > > > >>      <antlr4.version>4.13.2</antlr4.version>
> > > > > > >>      <antlr4-c3.version>1.2.0x</antlr4-c3.version>
> > > > > > >>      <grpc.version>1.76.0</grpc.version>
> > > > > > >>      <protobuf.version>4.32.1</protobuf.version>
> > > > > > >>
> > > > > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
> > > > > > >>      <gop-root>${maven.multiModuleProjectDirectory}</gop-root>
> > > > > > >>      <maven.compiler.proc>full</maven.compiler.proc>
> > > > > > >>
> > > <surefire-report-phase>prepare-package</surefire-report-phase>
> > > > > > >>      <os-maven-plugin.version>1.7.1</os-maven-plugin.version>
> > > > > > >>
> > > > > >
> > <protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
> > > > > > >>      <replacer.version>1.5.3</replacer.version>
> > > > > > >> </properties>
> > > > > > >>
> > > > > > >> and
> > > > > > >>
> > > > > > >> <dependency>
> > > > > > >>      <groupId>org.springframework.boot</groupId>
> > > > > > >>
> > > > > >
> > >
> <artifactId>spring-boot-starter-oauth2-authorization-server</artifactId>
> > > > > > >>      <version>${springboot.version}</version>
> > > > > > >> </dependency>
> > > > > > >>
> > > > > > >> so seems it be better to let the version in parent use a same
> > > > > propertie
> > > > > > >> with the dependency.
> > > > > > >> so we have to use a ci friendly property
> > > > > > >> but we already use revision for the project version, and
> > > > > sha/changelist
> > > > > > >> seems not quite suitable
> > > > > > >> so maybe we shall add rule to make every of ci_friendly_*
> > > property be
> > > > > > >> ci_friendly property?
> > > > > > >>
> > > > > > >>
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: [email protected]
> > > > > > For additional commands, e-mail: [email protected]
> > > > > >
> > > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > ------------------------
> > > > Guillaume Nodet
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [email protected]
> > > For additional commands, e-mail: [email protected]
> > >
> > >
> >
>
>
> --
> ------------------------
> Guillaume Nodet
>

Reply via email to