A standalone executable jar which uses Eclipse Aether libraries to download via HTTP(S) an artifact from a remote Maven 2 format repository.
This is a modified version of a sonatype's artifact-resolver tool app
./gradlew build
java -jar artifact-grabber.jar
--repository-url "http://remote-repository.com/public/"
--user user:pass // optional if authentication not required
--output // directory download to, optional (default is current)
--name // artifact new name, optional
com.mypackage:artifact
If version of the artifact is not specified then you will get latest version (including SNAPSHOT versions).
To get latest non-SNAPSHOT version use pseudo version value 'RELEASE'. Example: com.mypackage:artifact:RELEASE
The script uses Groovy CliBuilder to process arguments. You can create a file and put arguments, like auth, in that file instead.
Example:
- Create a file named
script.args
in the same directory as the jar - The contents of the file can contain an argument on each line, like this:
--repository-url "http://remote-repository.com/public/" --user user:pass --name artifact.jar
- Use the special
@
prefix and pass the file name as an argument to the script. Each line of the file will be read as if it was passed on the command line. Example:java -jar artifact-grabber.jar @script.args com.mypackage:artifact