maven-git-versioning-extension icon indicating copy to clipboard operation
maven-git-versioning-extension copied to clipboard

Reproducible Builds not working

Open ahoehma opened this issue 1 year ago • 0 comments

I have this settings:

<configuration xmlns="https://github.com/qoomon/maven-git-versioning-extension"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="https://github.com/qoomon/maven-git-versioning-extension https://qoomon.github.io/maven-git-versioning-extension/configuration-9.4.0.xsd">
  <disable>true</disable>
  <updatePom>false</updatePom>
  <refs>
    <ref type="branch">
      <pattern>develop</pattern>
      <version>${version}</version>
    </ref>
    <ref type="branch">
      <pattern>master</pattern>
      <version>${version.core}</version>
    </ref>
    <ref type="branch">
      <pattern>feature/(.+)</pattern>
      <version>${version.core}-${ref.slug}-SNAPSHOT</version>
    </ref>
    <ref type="branch">
      <pattern>renovate/(.+)</pattern>
      <version>${version.core}-${ref.slug}-SNAPSHOT</version>
      <properties>
        <!-- https://maven.apache.org/guides/mini/guide-reproducible-builds.html -->
        <project.build.outputTimestamp>${commit.timestamp}</project.build.outputTimestamp>
      </properties>
    </ref>
    <ref type="tag">
      <pattern><![CDATA[v(?<version>.*)]]></pattern>
      <version>${ref.version}</version>
    </ref>
  </refs>
  <!-- optional fallback configuration in case of no matching ref configuration-->
  <rev>
    <version>${commit}</version>
  </rev>
</configuration>

I enabled the "Reproducible Builds" for only renovate branches now ... just to play with it.

The I call this inside a renovate checkout branch:

VERSIONING_DISABLE=false mvn help:evaluate -Dexpression=project.build.outputTimestamp -q -DforceStdout -nsu

And I got:

null object or invalid expression

I guess the branch-based property set is not working - or?

My original target is this mvn call:

VERSIONING_DISABLE=false mvn artifact:check-buildplan

And here I got this:

[INFO] BuildTimeEventSpy is registered.
[INFO] Loading cache configuration from D:\Dev\git\coc\spice-configuration-cluster\.mvn\maven-build-cache-config.xml
[INFO] Scanning for projects...
[INFO]
[INFO] --- me.qoomon:maven-git-versioning-extension:9.8.1 [core extension] ----
[INFO] matching ref: BRANCH - renovate/all-openapi-deps
[INFO] ref configuration: BRANCH - pattern: renovate/(.+)
[INFO]   describeTagFirstParent: true
[INFO]   version: ${version.core}-${ref.slug}-SNAPSHOT
[INFO]   properties:
[INFO]     project.build.outputTimestamp - ${commit.timestamp}
[INFO]
[INFO] com.foobar.spice.cc:cc
[INFO] set version to 2024.16.0-renovate-all-openapi-deps-SNAPSHOT
...

So it seems the extension try to assign the property but its never reaching my "real" build.

My maven version is:

$mvn --version
Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: D:\Dev\ApacheMaven\current-maven
Java version: 17.0.4, vendor: Oracle Corporation, runtime: D:\Dev\Java\jdk-17.0.4
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Or do I totally misunderstood the feature? :-)

Kind regards Andreas

ahoehma avatar Oct 15 '24 07:10 ahoehma