maven-download-plugin/maven-download-plugin — pull request #18 by michaelsembwever (2013-08-14 19:48:54+00:00)
Title: multi-thread and multi-build safe (filelocks around io operations)

download-maven-plugin easily breaks with multiple threads builds (-T option), or with multiple builds running in parallel.

For example the plugin will often fail on ci (bamboo, jenkins, etc) servers with EOFException (DownloadCache.loadIndex(DownloadCache.java:105)) or IOException "Failed to copy full contents from …" (DownloadCache.install(DownloadCache.java:95)).

These concerns are also raised by https://github.com/maven-download-plugin/maven-download-plugin/issues/2

This pull request solves these problems by using FileLocks and Java7's nio enhancements.
Copying files is done "safely" with Files.copy(..), and load and saving the cache index file is down with FileLocks.

Java7 try-resource has been taken advantage of as well.

The integration tests were made to work again by bringing the version up to date and correctly the arfitactId.