Skip to content

Regression on 1.7.1 and later - properties no longer resolved in <version> tag #478

@EstelaGarcia

Description

@EstelaGarcia

We have a versioning system that relies on dynamic properties. For all our projects, the revision is defined as follows:

<version>${timestamp}-GID${revision}</version>

Where timestamp is defined as the yyyyMMdd'-'HHmmss of : <timestamp>${maven.build.timestamp}</timestamp>

And revision is calculated from the git commit id and passed in (defaulting to "developer" if not passed in).

Up until (and including) 1.7.0, we were obtaining the expected results, of both those properties being resolved when flattening the pom, with the pluging configured as follows:

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>flatten-maven-plugin</artifactId>
                    <version>1.7.0</version>
                    <configuration>
                        <updatePomFile>true</updatePomFile>
                        <flattenMode>resolveCiFriendliesOnly</flattenMode>
                    </configuration>
                    <executions>
                        <execution>
                            <id>flatten</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>flatten</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>flatten.clean</id>
                            <phase>clean</phase>
                            <goals>
                                <goal>clean</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

However, as of 1.7.1, this is no longer the case. The flattened pom ends up containing this <version>${timestamp}-GIDdeveloper</version>

As opposed to the expected <version>20250730-125417-GIDdeveloper</version>

I believe this is related to the changes made to address #400,

I have played around with different flatten modes, and while other modes do indeed resolve the problem with the resolution of the tag, they also remove the section, which we do require in some of our poms (parent poms).

A minimum pom to reproduce the issue is this one:
sample.pom.zip

Desired effect: flattened pom looks like this:

.flattened-pom.zip

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions