Created
January 7, 2016 09:51
-
-
Save Ladicek/8a4f93beb66751f7d134 to your computer and use it in GitHub Desktop.
deploy *-sources.jar to internal Maven repository
This file contains 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
#!/bin/bash | |
# successful "mvn clean install" or a variant thereof (e.g. -DskipTests) | |
# is typically required before running this script | |
REPOSITORY_ID=... | |
REPOSITORY_URL=... | |
mvn clean source:jar | |
for JAR in $(find . -name "*-sources.jar") ; do | |
echo $JAR | |
ABSOLUTE_PATH=$(readlink -f $JAR) | |
pushd $(dirname $JAR)/../ > /dev/null | |
GROUP_ID=$(mvn -o help:evaluate -Dexpression=project.groupId | grep -v -E '^\[|Downloading') | |
ARTIFACT_ID=$(mvn -o help:evaluate -Dexpression=project.artifactId | grep -v -E '^\[|Downloading') | |
VERSION=$(mvn -o help:evaluate -Dexpression=project.version | grep -v -E '^\[|Downloading') | |
echo $GROUP_ID:$ARTIFACT_ID:$VERSION | |
mvn deploy:deploy-file \ | |
-Dfile=$ABSOLUTE_PATH \ | |
-DrepositoryId=$REPOSITORY_ID \ | |
-Durl=$REPOSITORY_URL \ | |
-DgroupId=$GROUP_ID \ | |
-DartifactId=$ARTIFACT_ID \ | |
-Dversion=$VERSION \ | |
-Dclassifier=sources \ | |
-Dpackaging=jar \ | |
-DgeneratePom=false | |
popd > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment