Skip to content

Instantly share code, notes, and snippets.

@themerius
Created August 2, 2017 11:23
Show Gist options
  • Select an option

  • Save themerius/17590ae1fefd4907c8e1776c2b558a84 to your computer and use it in GitHub Desktop.

Select an option

Save themerius/17590ae1fefd4907c8e1776c2b558a84 to your computer and use it in GitHub Desktop.
Download a maven artifact to directory
#!/bin/bash
# Background: This is useful to download executable JARs,
# so wie can use Artifactory+Maven like an "App Store for Java services".
# This will download the newest version,
# but you can also declare a specific version number.
VERSION="LATEST"
ARTIFACT="com.hazelcast:hazelcast-all:$VERSION:jar"
# Docs: https://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html
mvn dependency:copy -U -Dartifact=$ARTIFACT \
-DoutputDirectory=$HOME \
-Dmdep.useBaseVersion=true \
-Dmdep.stripVersion=true
# Now you should be able to run it like that:
# $ java -jar $HOME/hazelcast-all.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment