Skip to content

CHECK does not work for SNAPSHOTs when there is also either a sources or javadoc jar #27

Description

@rondagostino

At this line:

versions[1]=$(echo $metadata | xmllint --xpath "/metadata/versioning/snapshotVersions/snapshotVersion[extension='$packaging']/value/text()" - 2>/dev/null)

The version returned is mangled when there is a sources or Javadoc jar. For example, assume this is metadata.xml:

<metadata modelVersion="1.1.0">
  <groupId>com.example</groupId>
  <artifactId>theArtifact</artifactId>
  <version>0.0.2-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <timestamp>20181129.175944</timestamp>
      <buildNumber>1</buildNumber>
    </snapshot>
    <lastUpdated>20181129175945</lastUpdated>
    <snapshotVersions>
      <snapshotVersion>
        <classifier>sources</classifier>
        <extension>jar</extension>
        <value>0.0.2-20181129.175944-1</value>
        <updated>20181129175944</updated>
      </snapshotVersion>
      <snapshotVersion>
        <extension>jar</extension>
        <value>0.0.2-20181129.175944-1</value>
        <updated>20181129175944</updated>
      </snapshotVersion>
      <snapshotVersion>
        <extension>pom</extension>
        <value>0.0.2-20181129.175944-1</value>
        <updated>20181129175944</updated>
      </snapshotVersion>
    </snapshotVersions>
  </versioning>
</metadata>

The code will execute this command with the above as input:

xmllint --xpath "/metadata/versioning/snapshotVersions/snapshotVersion[extension='jar']/value/text()" -

And the returned value is incorrect:
0.0.2-20181129.175944-10.0.2-20181129.175944-1

The correct command to run might be this one (for example):

xmllint --xpath "/metadata/versioning/snapshotVersions/snapshotVersion[extension='jar' and count(*)=3]/value/text()" -

And the correct version is calculated:
0.0.2-20181129.175944-1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions