From 720e64f615934197876a70124e0a65cb282f0753 Mon Sep 17 00:00:00 2001 From: Simon Toens Date: Tue, 2 Mar 2021 11:23:28 +0900 Subject: [PATCH] Don't hardcode repositoryId (#100) --- maven/maven.sh | 4 ++++ maven/maven_functions.sh | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/maven/maven.sh b/maven/maven.sh index 6b068b5..3a1bf70 100755 --- a/maven/maven.sh +++ b/maven/maven.sh @@ -62,6 +62,10 @@ Usage: maven.sh -a action(s) [-t bazel package] or ${REPOSITORY_URL}/releases/content, based on whether the artifact version ends in -SNAPTSHOT or not. + REPOSITORY_ID: in settings.xml, the of the entry to use for + authentication. Defaults to "nexus". + See https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html + POM_DESCRIPTION: if set, used as the value of the element in the generated pom(s). diff --git a/maven/maven_functions.sh b/maven/maven_functions.sh index 4f431bc..d60dd5a 100644 --- a/maven/maven_functions.sh +++ b/maven/maven_functions.sh @@ -240,6 +240,10 @@ _deploy_artifacts_to_nexus() { exit 1 fi + if [ -z "$REPOSITORY_ID" ]; then + REPOSITORY_ID="nexus" + fi + if [[ "$version" = *"-SNAPSHOT" ]]; then repository="snapshots" else @@ -285,7 +289,7 @@ _deploy_artifacts_to_nexus() { mvn ${MVN_ARGS} org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy-file \ -DpomFile=$pom_path \ -Dfile=$artifact_path \ - -DrepositoryId="default" \ + -DrepositoryId=${REPOSITORY_ID} \ -Durl=$full_repository_url \ $file_arg $type_arg $classifier_arg }