ThoughtWorksInc / go-maven-poller

Go plugin that polls Maven (Nexus) repositories
Apache License 2.0
3 stars 19 forks source link

Latest Snapshot is not used #4

Open ghost opened 11 years ago

ghost commented 11 years ago

When the poller identifies that a snapshot is the latest version, it can incorrectly pull the wrong version of the snapshot.

Looks like in: com.tw.go.plugin.maven.client.RepositoryClient Method : Files getFiles(MavenVersion version)

It assumes that the first result is the correct one... off the files list it just pulls element 0 -> files.get(0)

For snapshots versions the nexus response can contain multiple files and it does not appear to be safe to assume that the latest version will be the first one listed (element 0). The lastModified element of the nexus response should be considered or the internal identifier can be parsed from the artifact name: for instance version some-jar-1.0-SNAPSHOT in the response the actual artifact is like: some-jar-1.0-20131010-548425-3.jar which could be parsed to determine the correct latest version.

This is similar to Issue #3, but that issue results in the poller not seeing that a new snapshot version is available. This issue causes is when it sees that it does have a new snapshot, but picks the wrong one to send through the pipeline.