|
2 | 2 | set -ev
|
3 | 3 | cd $(dirname $(readlink -f $0))
|
4 | 4 |
|
5 |
| -if [ -f $MAVEN_CFG/repository ]; then |
6 |
| - echo "Using cached maven dependencies..." |
7 |
| - exit 0 |
8 |
| -fi |
9 |
| - |
10 |
| -if [ "$ORACLE_OTN_USER" == "" ] || [ "$ORACLE_OTN_PASSWORD" == "" ]; then |
11 |
| - echo "Oracle OTN username/password not specified." |
12 |
| - exit 1 |
13 |
| -fi |
14 |
| - |
15 | 5 | # Download wagon-http recommended by Oracle.
|
16 | 6 | # On maven latest version this is not needed, but travis doesn't have it.
|
17 |
| -curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar" |
18 |
| -sudo mv wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/ |
| 7 | +if [ ! -f $CACHE_DIR/wagon-http-2.8-shaded.jar ]; then |
| 8 | + curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar" |
| 9 | + mv wagon-http-2.8-shaded.jar $CACHE_DIR/ |
| 10 | + sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/ |
| 11 | +else |
| 12 | + echo "Using cached wagon-http..." |
| 13 | + sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/ |
| 14 | +fi |
19 | 15 |
|
20 | 16 | # Create the settings file with oracle server config.
|
21 |
| -cp settings.xml $MAVEN_CFG/settings.xml |
22 |
| -#cp settings.tmpl.xml $MAVEN_CFG/settings.xml |
23 |
| -#sed -i -e "s|###USERNAME###|$ORACLE_OTN_USER|g" $MAVEN_CFG/settings.xml |
24 |
| -#sed -i -e "s|###PASSWORD###|$ORACLE_OTN_PASSWORD|g" $MAVEN_CFG/settings.xml |
| 17 | +# If file already exists, Oracle dependencies were cached on previous build. |
| 18 | +if [ ! -f $MAVEN_CFG/.cached ]; then |
| 19 | + cp settings.xml $MAVEN_CFG/settings.xml |
| 20 | + touch $MAVEN_CFG/.cached |
| 21 | +else |
| 22 | + echo "Using cached maven settings..." |
| 23 | +fi |
0 commit comments