Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rondagostino opened this issue Nov 29, 2018 · 2 comments

Comments

@rondagostino
Copy link

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

@patrickcrocker
Copy link
Member

Thanks, I'll review this and add a new test case to handle this situation.

@xiwix
Copy link

xiwix commented Dec 6, 2018

Faced same issue and created fix. See pull request #30.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants