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