Skip to content
  • English
    • English
    • Deutsch
    • Čeština
    • Español
    • Français
    • Italiano
    • Polski
    • Slovenčina
    • 日本語
    • 中文 (中国)
  • HTML5 Games
  • IntelliJ Idea tips
  • Online UTF-8 repairer
  • QR code generator
  • Siriel Adventures
  • SDL2 for Android/iOS
  • Talks

Georgik.Rocks

Useful software tips

  • English
    • English
    • Deutsch
    • Čeština
    • Español
    • Français
    • Italiano
    • Polski
    • Slovenčina
    • 日本語
    • 中文 (中国)
  • HTML5 Games
  • IntelliJ Idea tips
  • Online UTF-8 repairer
  • QR code generator
  • Siriel Adventures
  • SDL2 for Android/iOS
  • Talks
Software engineering

PowerShell: Get version number from maven-metadata.xml

Posted on7. May 20137. May 2013Authorgeorgik

Simple task. There is maven-metadata.xml file stored on internet and you need to get version number of latest jar.

Let’s use maven-metadata.xml from Forsqaure Java API.

File looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
  <groupId>fi.foyt</groupId>
  <artifactId>foursquare-api</artifactId>
  <version>1.0.2-SNAPSHOT</version>
  <versioning>
    <snapshot>
      <timestamp>20120607.214317</timestamp>
      <buildNumber>6</buildNumber>
    </snapshot>
    <lastUpdated>20120607214317</lastUpdated>
    <snapshotVersions>
      <snapshotVersion>
        <extension>jar</extension>
        <value>1.0.2-20120607.214317-6</value>
        <updated>20120607214317</updated>
      </snapshotVersion>
    </snapshotVersions>
  </versioning>
</metadata>

Powershell script is very simple:

$url = "https://foursquare-api-java.googlecode.com/svn-history/r288/repository/fi/foyt/foursquare-api/1.0.2-SNAPSHOT/maven-metadata.xml"
$data =(New-Object System.Net.WebClient).DownloadString($url)
$data.metadata.versioning.snapshotVersions.snapshotVersion[0].value

Result:

1.0.2-20120607.214317-6
Posted in Software engineeringTagged Maven, metadata, Microsoft, PowerShell, xml

Post navigation

How to stitch maps by Photoshop
Vim mode in Cloud9 IDE

Topics

  • Development (76)
  • Geography (2)
  • Graphics (17)
  • IoT (29)
  • Misc (5)
  • Mobile (2)
  • Music (1)
  • Office automation (12)
  • Rich Internet Application (11)
  • Software engineering (82)

Sitemap

© 2009-2024 Juraj Michalek
Powered by WordPress / Theme by Design Lab
Exit mobile version