Last active
January 29, 2018 14:40
-
-
Save mkotsbak/23c15ceb1fac058d6f223ee93c2b6865 to your computer and use it in GitHub Desktop.
Script to upload all .jar and .pom files in a directory tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
MVN_BIN=/[maven_dir]/bin/mvn | |
REP_ID=repository_id | |
REP_URL=http://repository_url/ | |
INPUT_DIR=$1 # Where jar and pom files are located | |
DRY_RUN=false | |
POMS=`find $INPUT_DIR -name *.pom` | |
for POM in $POMS; do | |
echo Pom: $POM | |
JAR=`echo $POM | sed s/\.pom$/.jar/` | |
echo Jar: $JAR | |
# If there is no jar, just deploy the pom file | |
if [ -f $JAR ]; then | |
FILE_PARAM=$JAR | |
else | |
FILE_PARAM=$POM | |
fi | |
CMD="$MVN_BIN deploy:deploy-file -DpomFile=$POM -Dfile=$FILE_PARAM -DrepositoryId=$REP_ID -Durl=$REP_URL" | |
if [ "$DRY_RUN" = false ]; then | |
echo Running: $CMD | |
$CMD | |
else | |
echo Cmd to run: $CMD | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment