File: mvn-deploy.sh

package info (click to toggle)
guava-libraries 17.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 20,892 kB
  • ctags: 46,679
  • sloc: java: 259,710; xml: 1,226; sh: 29; makefile: 5
file content (40 lines) | stat: -rw-r--r-- 1,443 bytes parent folder | download | duplicates (2)
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
#!/bin/bash
#
# This script checks the java version and bails if it's less
# than Java6 (because we use @Override annotations on interface
# overriding methods.  It then proceeds to do a maven build that
# first cleans, then builds the normal lifecycle through compilation
# unit testing (if available) up to packaging.  It then packages
# the source, javadocs, and maven site.  It then signs the 
# artifacts with whatever pgp signature is the default of the 
# user executing it, and then deploys to the repository contained
# in the distributionManagement section of the pom.
#
# author: cgruber@google.com (Christian Edward Gruber)
#
if [[ -n ${JAVA_HOME} ]] ; then 
  JAVA_CMD=${JAVA_HOME}/bin/java
else
  JAVA_CMD=java
fi
java_version="$(${JAVA_CMD} -version 2>&1 | grep -e 'java version' | awk '{ print $3 }')"

# This test sucks, but it's short term
# TODO(cgruber) strip the quotes and patch version and do version comparison. 
greater_than_java5="$(echo ${java_version} | grep -e '^"1.[67]')"

if [[ -z ${greater_than_java5} ]] ; then
  echo "Your java version is ${java_version}."
  echo "You must use at least a java 6 JVM to build and deploy this software."
  exit 1
else
  echo "Building with java ${java_version}"
fi

if [[ $# > 0 ]]; then
  params+=" -Dgpg.keyname=${1}"
  gpg_sign_plugin=" gpg:sign"
fi
cmd="mvn clean package source:jar site:jar javadoc:jar ${gpg_sign_plugin} deploy ${params}"
echo "Executing ${cmd}"
${cmd}