Skip to content

SNAPSHOTs: maven-metadata incorrectly calculates snapshotVersion? #191

@mmoayyed

Description

@mmoayyed

Expected and Results

Perhaps a continuation of #73

Using the latest versions of the plugin here, 1.1.x, I see the following maven-metadata.xml file is published for an artifact:

<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
  <groupId>org.apereo.cas</groupId>
  <artifactId>cas-server-support-bom</artifactId>
  <versioning>
    <lastUpdated>20250911235415</lastUpdated>
    <snapshot>
      <timestamp>20250911.235415</timestamp>
      <buildNumber>230</buildNumber>
    </snapshot>
    <snapshotVersions>
      <snapshotVersion>
        <extension>pom</extension>
        <value>7.3.0-20250911.235415-1</value>
        <updated>20250911235415</updated>
      </snapshotVersion>
      <snapshotVersion>
        <extension>pom.asc</extension>
        <value>7.3.0-20250911.235415-1</value>
        <updated>20250911235415</updated>
      </snapshotVersion>
    </snapshotVersions>
  </versioning>
  <version>7.3.0-SNAPSHOT</version>
</metadata>

Note how the <buildNumber>230</buildNumber> is set, yet all <value> tags point to -1. This effectively makes the artifact invisible to Maven:

The project org.apereo.cas:apereo-cas-build:1.0.0-SNAPSHOT (/Users/misagh/Workspace/GitWorkspace/cas-server/ci/verify-pom.xml) has 5 errors
[ERROR]     Non-resolvable import POM: The following artifacts could not be resolved: org.apereo.cas:cas-server-support-bom:pom:7.3.0-SNAPSHOT (absent): Could not find artifact org.apereo.cas:cas-server-support-bom:pom:7.3.0-20250911.235415-1 in sonatype-snapshots (https://central.sonatype.com/repository/maven-snapshots/) @ line 31, column 25 -> [Help 2]

I suspect the counter here should follow the build number, and not restart at 1. Is there a bug here?

Related environment and versions

  • Gradle 9.1 RC3
  • Java 21

Reproduction steps

  • Attempting to publish SNAPSHOTs via:
./gradlew publishAggregationToCentralPortalSnapshots \
    --info -x test -x javadoc -x check --no-daemon --parallel \
    -DskipAot=true -DpublishSnapshots=true --stacktrace \
    --no-configuration-cache --configure-on-demand \
    -DrepositoryUsername="$REPOSITORY_USER" \
    -DrepositoryPassword="$REPOSITORY_PWD"

I see:

Nmcp: put 'https://central.sonatype.com/repository/maven-snapshots/org/apereo/cas/cas-server-support-bom/7.3.0-SNAPSHOT/maven-metadata.xml'

The produced metadata seems incorrect:
https://central.sonatype.com/repository/maven-snapshots/org/apereo/cas/cas-server-support-bom/7.3.0-SNAPSHOT/maven-metadata.xml

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions