Skip to content

Fix travis build cache #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
global:
- DOCKER_CFG=$HOME/.docker
- DOCKER_REPO="viniciusam/oracledb"
- CACHE_DIR=$HOME/.cache
- MAVEN_HOME=/usr/local/maven
- MAVEN_CFG=$HOME/.m2
- API_DB_URL="127.0.0.1:1521:XE"
Expand All @@ -23,8 +24,8 @@ env:
cache:
directories:
- $DOCKER_CFG
- $CACHE_DIR
- $MAVEN_CFG
- $MAVEN_HOME/lib/ext # Used to cache wagon-http lib.

install:
- bash .travis/maven_cfg.sh
Expand Down
31 changes: 15 additions & 16 deletions .travis/maven_cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
set -ev
cd $(dirname $(readlink -f $0))

if [ -f $MAVEN_CFG/repository ]; then
echo "Using cached maven dependencies..."
exit 0
fi

if [ "$ORACLE_OTN_USER" == "" ] || [ "$ORACLE_OTN_PASSWORD" == "" ]; then
echo "Oracle OTN username/password not specified."
exit 1
fi

# Download wagon-http recommended by Oracle.
# On maven latest version this is not needed, but travis doesn't have it.
curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar"
sudo mv wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
if [ ! -f $CACHE_DIR/wagon-http-2.8-shaded.jar ]; then
curl -L -O "http://central.maven.org/maven2/org/apache/maven/wagon/wagon-http/2.8/wagon-http-2.8-shaded.jar"
mv wagon-http-2.8-shaded.jar $CACHE_DIR/
sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
else
echo "Using cached wagon-http..."
sudo cp $CACHE_DIR/wagon-http-2.8-shaded.jar $MAVEN_HOME/lib/ext/
fi

# Create the settings file with oracle server config.
cp settings.xml $MAVEN_CFG/settings.xml
#cp settings.tmpl.xml $MAVEN_CFG/settings.xml
#sed -i -e "s|###USERNAME###|$ORACLE_OTN_USER|g" $MAVEN_CFG/settings.xml
#sed -i -e "s|###PASSWORD###|$ORACLE_OTN_PASSWORD|g" $MAVEN_CFG/settings.xml
# If file already exists, Oracle dependencies were cached on previous build.
if [ ! -f $MAVEN_CFG/.cached ]; then
cp settings.xml $MAVEN_CFG/settings.xml
touch $MAVEN_CFG/.cached
else
echo "Using cached maven settings..."
fi