-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
upload-single.sh
executable file
·51 lines (41 loc) · 1.13 KB
/
upload-single.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -e
REPOSITORY_ID="exist-db"
SNAPSHOTS_REPOSITORY_ID="exist-db-snapshots"
# Nexus 2 URL
#REPOSITORY_URL="http://repo.evolvedbinary.com/content/repositories/exist-db/"
# Nexus 3 URL
REPOSITORY_URL="http://repo.evolvedbinary.com/repository/exist-db/"
SNAPSHOTS_REPOSITORY_URL="http://repo.evolvedbinary.com/repository/exist-db-snapshots/"
GROUP_ID="${1}"
ARTIFACT_ID="${2}"
VERSION="${3}"
for i in "$@"
do
case $i in
-l|--local)
LOCAL=YES
shift # past argument with no value
;;
*)
# unknown option
;;
esac
done
# Install to local repo or upload to remote
MAVEN_CMD=""
if [ -n "${LOCAL}" ]
then
MAVEN_CMD="mvn install:install-file"
else
MAVEN_CMD="mvn deploy:deploy-file -DrepositoryId=${REPOSITORY_ID} -Durl=${REPOSITORY_URL}"
fi
DIR="${GROUP_ID//\.//\/}/${ARTIFACT_ID}/${VERSION}"
POM_FILE="${DIR}/${ARTIFACT_ID}-${VERSION}.pom"
JAR_FILE="${DIR}/${ARTIFACT_ID}-${VERSION}.jar"
if [ ! -f $JAR_FILE ]; then
echo "WARNING: Jar file not found, will use Pom file as Jar file..."
JAR_FILE="${POM_FILE}"
fi
CMD="${MAVEN_CMD} -DpomFile=${POM_FILE} -Dfile=${JAR_FILE}"
eval $CMD