Skip to content

Instantly share code, notes, and snippets.

@tyrannasaurusbanks
Created April 1, 2014 14:07
Show Gist options
  • Save tyrannasaurusbanks/9914787 to your computer and use it in GitHub Desktop.
Save tyrannasaurusbanks/9914787 to your computer and use it in GitHub Desktop.
Install .jar's locally
#!/bin/sh
# Designed to be run from a project root directory, the script will:
# - recursively traverse down the folder structure from the execution location
# - look for 'target' folders
# - look for jar's with a name matching a pattern like '*.jar'
# - install all found jar's into the local maven repo
#
# NOTE: if you need to install test jar's then you need to specify an option -Dpackaging=test-jar
echo "Started jar install script!"
echo "Hunting for jar's to install..."
x=1
for FILE in `find . -path '.*/target/*.jar' | grep -v '.*-sources.jar'`
do
echo "Installing jar: " $FILE
mvn org.apache.maven.plugins:maven-install-plugin:2.5.1:install-file -Dfile=$FILE -Dpackaging=jar
echo "Jar installed!"
x=$(( $x + 1 ))
done
echo "Installed $x jars."
echo "No more jar's to install, finished!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment