1+ #! /bin/bash
2+
3+ # Get Project Repo
4+ mybatis_repo=$( git config --get remote.origin.url 2>&1 )
5+ echo " Repo detected: ${mybatis_repo} "
6+
7+ # Get the Java version.
8+ # Java 1.5 will give 15.
9+ # Java 1.6 will give 16.
10+ # Java 1.7 will give 17.
11+ # Java 1.8 will give 18.
12+ VER=` java -version 2>&1 | sed ' s/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q' `
13+ echo " Java detected: ${VER} "
14+
15+ # We build for several JDKs on Travis.
16+ # Some actions, like analyzing the code (Coveralls) and uploading
17+ # artifacts on a Maven repository, should only be made for one version.
18+
19+ # If the version is 1.6, then perform the following actions.
20+ # 1. Upload artifacts to Sonatype.
21+ # 2. Use -q option to only display Maven errors and warnings.
22+ # 3. Use --settings to force the usage of our "settings.xml" file.
23+
24+ # If the version is 1.7, then perform the following actions.
25+ # 1. Notify Coveralls.
26+ # 2. Deploy site
27+ # 3. Use -q option to only display Maven errors and warnings.
28+
29+ if [ " $mybatis_repo " == " https://github.com/mybatis/spring.git" ] && [ " $TRAVIS_PULL_REQUEST " == " false" ] && [ " $TRAVIS_BRANCH " == " master" ]; then
30+ if [ $VER == " 16" ]; then
31+ mvn clean deploy -q --settings ./travis/settings.xml
32+ echo -e " Successfully deployed SNAPSHOT artifacts to Sonatype under Travis job ${TRAVIS_JOB_NUMBER} "
33+ elif [ $VER == " 17" ]; then
34+ mvn clean test jacoco:report coveralls:report -q
35+ echo -e " Successfully ran coveralls under Travis job ${TRAVIS_JOB_NUMBER} "
36+ # various issues exist currently in building this so comment for now
37+ # mvn site site:deploy -q
38+ # echo -e "Successfully deploy site under Travis job ${TRAVIS_JOB_NUMBER}"
39+ fi
40+ else
41+ echo " Travis build skipped"
42+ fi
0 commit comments