-
Notifications
You must be signed in to change notification settings - Fork 7
/
assemble
executable file
·57 lines (43 loc) · 1.38 KB
/
assemble
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/sh
echo "Running: $0"
if [ -d /tmp/src ]; then
# We are in openshift using sourceStrategy
echo "OpenShift: using /tmp/src"
LOCAL_SOURCE_DIR=/tmp/src
else
mkdir -p /tmp/src
git clone ${OPENSHIFT_BUILD_SOURCE} /tmp/src
cd /tmp/src
git checkout ${OPENSHIFT_BUILD_REFERENCE}
cd -
LOCAL_SOURCE_DIR=/tmp/src
fi
if [ -f "$LOCAL_SOURCE_DIR/pom.xml" ]; then
cd $LOCAL_SOURCE_DIR
# Add JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
# Add JVM default options
export MAVEN_OPTS="${MAVEN_OPTS:-$(/opt/run-java/java-default-options)}"
MAVEN_ARGS="${MAVEN_ARGS--e -Popenshift -DskipTests -Dcom.redhat.xpaas.repo.redhatga package}"
# Use maven batch mode (CLOUD-579)
# Always force IPv4 (CLOUD-188)
# Append user-supplied arguments (CLOUD-412)
MAVEN_ARGS="$MAVEN_ARGS --batch-mode -Djava.net.preferIPv4Stack=true ${MAVEN_ARGS_APPEND}"
echo "Found pom.xml... attempting to build with 'mvn ${MAVEN_ARGS}'"
echo "Using MAVEN_OPTS '${MAVEN_OPTS}'"
echo "Using $(mvn --version)"
# Execute the actual build
echo "Doing mvn $MAVEN_ARGS install"
mvn $MAVEN_ARGS install
ERR=$?
if [ $ERR -ne 0 ]; then
echo "Aborting due to error code $ERR from Maven build"
exit $ERR
fi
# Copy the war to /deployments/webapps
cp target/*.war /deployments/webapps
cd -
else
echo "Aborting due to missing pom.xml for Maven build"
exit 1
fi