diff --git a/common/build_common.sh b/common/build_common.sh
new file mode 100755
index 00000000..70801fe0
--- /dev/null
+++ b/common/build_common.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+set -x
+ME=`whoami`
+echo "Running as user: $ME"
+MVN=$1
+VERSION=$2
+
+check_user() {
+ ME=$1
+ if [ "${ME}" != "jenkins" ]; then
+ echo "\nERROR: Download monasca-common and do a mvn install to install the monasca-commom jars\n" 1>&2
+ exit 1
+ fi
+}
+
+BUILD_COMMON=false
+POM_FILE=~/.m2/repository/monasca-common/monasca-common/${VERSION}/monasca-common-${VERSION}.pom
+if [ ! -r "${POM_FILE}" ]; then
+ check_user ${ME}
+ BUILD_COMMON=true
+fi
+
+# This should only be done on the stack forge system
+if [ "${BUILD_COMMON}" = "true" ]; then
+ git clone https://github.com/stackforge/monasca-common
+ cd monasca-common
+ ${MVN} clean
+ ${MVN} install
+fi
diff --git a/download/pom.xml b/common/pom.xml
similarity index 80%
rename from download/pom.xml
rename to common/pom.xml
index 197250f1..c1001dd2 100644
--- a/download/pom.xml
+++ b/common/pom.xml
@@ -3,7 +3,7 @@
4.0.0
monasca-persister
- monasca-persister-download
+ monasca-persister-common
1.0.0-SNAPSHOT
http://github.com/stackforge/monasca-persister
pom
@@ -11,7 +11,6 @@
${project.version}
- true
UTF-8
UTF-8
@@ -30,9 +29,16 @@
exec
+
+ package-execution
+ clean
+
+ exec
+
+
- ./download.sh
+ ./build_common.sh
diff --git a/download/download.sh b/download/download.sh
deleted file mode 100755
index 02cf233b..00000000
--- a/download/download.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-set -x
-ME=`whoami`
-echo "Running as user: $ME"
-VERSION=$1
-
-check_user() {
- ME=$1
- if [ "${ME}" != "jenkins" ]; then
- echo "\nERROR: Download monasca-common and do a mvn install to install the monasca-commom jars\n" 1>&2
- exit 1
- fi
-}
-
-# TODO: Grep these out of the pom itself rather than have them explicitly listed
-JARS="
-monasca-common-util
-monasca-common-model
-monasca-common-influxdb
-"
-for JAR in $JARS; do
- JARFILE=~/.m2//repository/monasca-common/${JAR}/${VERSION}/${JAR}-${VERSION}.jar
- if [ ! -r "$JARFILE" ]; then
- check_user ${ME}
- # Download it from stackforge
- FILE=`basename $JARFILE`
- curl http://tarballs.openstack.org/ci/monasca-common/${FILE} > ${FILE}
- # Upload into the local repository
- POM=META-INF/maven/monasca-common/${JAR}/pom.xml
- jar -xvf ${FILE} ${POM}
- TMPFILE=pom.$$
- sed -e "s/\${computedVersion}/${VERSION}/" ${POM} > ${TMPFILE}
- mv ${TMPFILE} ${POM}
- mvn install:install-file -Dfile=${FILE} -DgroupId=monasca-common \
- -DartifactId=${JAR} -Dversion=${VERSION} -Dpackaging=jar -DpomFile=${POM}
- fi
-done
-
-POM_FILE=~/.m2/repository/monasca-common/monasca-common/${VERSION}/monasca-common-${VERSION}.pom
-if [ ! -r "${POM_FILE}" ]; then
- check_user ${ME}
- TMPDIR=pom_tmp.$$
- mkdir -p ${TMPDIR}
- curl https://raw.githubusercontent.com/stackforge/monasca-common/master/java/pom.xml > ${TMPDIR}/pom.xml
- mvn install:install-file -DgroupId=monasca-common -DartifactId=monasca-common -Dversion=${VERSION} -Dpackaging=pom -Dfile=${TMPDIR}/pom.xml
- rm -fr ${TMPDIR}
-fi
-
-TEST_JARS="
-monasca-common-streaming
-"
-for TEST_JAR in $TEST_JARS; do
- JARFILE=~/.m2//repository/monasca-common/${TEST_JAR}/${VERSION}/${TEST_JAR}-${VERSION}-tests.jar
- if [ ! -r "$JARFILE" ]; then
- check_user ${ME}
- # Download it from stackforge
- FILE=`basename $JARFILE`
- curl http://tarballs.openstack.org/ci/monasca-common/${FILE} > ${FILE}
- # Upload into the local repository
- POM=META-INF/maven/monasca-common/${TEST_JAR}/pom.xml
- jar -xvf ${FILE} ${POM}
- TMPFILE=pom.$$
- sed -e "s/\${computedVersion}/${VERSION}/" ${POM} > ${TMPFILE}
- mv ${TMPFILE} ${POM}
- mvn install:install-file -Dfile=${FILE} -DgroupId=monasca-common \
- -DartifactId=${TEST_JAR} -Dversion=${VERSION} -Dpackaging=test-jar -DpomFile=${POM}
- fi
-done
diff --git a/java/pom.xml b/java/pom.xml
index b6820a6a..15bced8f 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -10,7 +10,16 @@
http://github.com/stackforge/monasca-persister
jar
+
+ 3.0
+
+
+
+ ${maven.build.timestamp}
+ yyyy-MM-dd'T'HH:mm:ss
+ ${project.version}-${timestamp}-${gitRevision}
+ ${project.artifactId}-${computedVersion}
1.0.0-SNAPSHOT
UTF-8
UTF-8
diff --git a/pom.xml b/pom.xml
index bfcd0e3a..cc9eb250 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,21 +4,13 @@
monasca
monasca-persister-base
- ${computedVersion}
- http://github.com/stackforge/monasca-common
+ 1.0.0-SNAPSHOT
+ http://github.com/stackforge/monasca-persister
pom
-
-
- 1.0.0
- ${versionNumber}-SNAPSHOT
-
+ ${version} ${sun.java.command}
true
UTF-8
UTF-8
@@ -29,55 +21,30 @@
scm:git:git@github.com:stackforge/monasca-persister
-
- download
- java
-
-
-
-
- release-deploy-url-override
-
-
- BUILD_NUM
-
-
-
- ${project.version}
-
-
-
-
-
- org.apache.maven.plugins
- maven-scm-plugin
- 1.9
-
- ${project.version}
-
-
org.codehaus.mojo
exec-maven-plugin
1.1.1
- some-execution
+ package-execution
package
exec
+
+ clean-execution
+ clean
+
+ exec
+
+
- ln
-
- -sf
- java/target
- target
-
+ run_maven.sh
diff --git a/run_maven.sh b/run_maven.sh
new file mode 100755
index 00000000..b5a153ba
--- /dev/null
+++ b/run_maven.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+# Download maven 3 if the system maven isn't maven 3
+VERSION=`mvn -v | grep "Apache Maven 3"`
+if [ -z "${VERSION}" ]; then
+ curl http://archive.apache.org/dist/maven/binaries/apache-maven-3.2.1-bin.tar.gz > apache-maven-3.2.1-bin.tar.gz
+ tar -xvzf apache-maven-3.2.1-bin.tar.gz
+ MVN=${PWD}/apache-maven-3.2.1/bin/mvn
+else
+ MVN=mvn
+fi
+
+# Get the expected common version
+COMMON_VERSION=$1
+# Get rid of the version argument
+shift
+
+# Get rid of the java property name containing the args
+shift
+
+RUN_BUILD=false
+for ARG in $*; do
+ if [ "$ARG" = "package" ]; then
+ RUN_BUILD=true
+ fi
+ if [ "$ARG" = "install" ]; then
+ RUN_BUILD=true
+ fi
+done
+
+if [ $RUN_BUILD = "true" ]; then
+ ( cd common; ./build_common.sh ${MVN} ${COMMON_VERSION} )
+ RC=$?
+ if [ $RC != 0 ]; then
+ exit $RC
+ fi
+fi
+
+# Invoke the maven 3 on the real pom.xml
+( cd java; ${MVN} -DgitRevision=`git rev-list HEAD --max-count 1 --abbrev=0 --abbrev-commit` $* )
+
+RC=$?
+
+# Copy the jars where the publisher will find them
+if [ $RUN_BUILD = "true" ]; then
+ ln -sf java/target target
+fi
+
+rm -fr apache-maven-3.2.1*
+exit $RC