aboutsummaryrefslogtreecommitdiffstats
blob: 3dcedd54dc65e5b4c511565c90f3f0d6e2163c94 (plain)
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
52
53
54
55
56
57
#!/bin/bash
#
# This script is used to upload bundles to Maven Central.
# Expects pom, jar, and source jar files for upload in current working directory
# For details, see: http://wiki.eclipse.org/RAP/Maven_Central
#
# Usage:
#   upload-maven [-n|--dry-run]

URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/
REPO=sonatype-nexus-staging
DRY=

fail() {
  echo ERROR: $1
  exit 1
}

while [ $# -gt 0 ]; do
  case $1 in
    -n|--dry-run) DRY=1;;
    *) fail "Illegal parameter: $1";;
  esac
  shift
done

if [ $DRY ]; then
  echo "Files to upload:"
  echo
fi

for pomfile in *.pom
do
  jarfile=${pomfile/.pom/.jar}
  sourcefile=${jarfile/_/.source_}
  test -f $pomfile || fail "POM file not found: $pomfile"
  test -f $jarfile || fail "JAR file not found: $jarfile"
  test -f $sourcefile || fail "Source JAR not found: $sourcefile"
  echo $jarfile
  if [ ! $DRY ]; then
    mvn gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} \
     -DpomFile=${pomfile} -Dfile=${jarfile}
  fi
  echo $sourcefile
  if [ ! $DRY ]; then
    mvn gpg:sign-and-deploy-file -Durl=${URL} -DrepositoryId=${REPO} \
     -DpomFile=${pomfile} -Dfile=${sourcefile} -Dclassifier=sources 
  fi
  echo
done

if [ ! $DRY ]; then
  echo "Done. Next steps:"
  echo "* go to https://oss.sonatype.org/ -> Staging Repositories"
  echo "* CLOSE the repository"
  echo "* download and check, then RELEASE it"
fi