]> source.dussan.org Git - sonarqube.git/commitdiff
Fix build of feature branches on Travis
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 21 Jul 2016 07:37:06 +0000 (09:37 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 21 Jul 2016 07:37:15 +0000 (09:37 +0200)
travis.sh

index 28d071da1641b8e29f176072cf4b4030d8e1703f..64e2905b17dc3264afb8ca8f05f153ed1577ed56 100755 (executable)
--- a/travis.sh
+++ b/travis.sh
@@ -14,7 +14,11 @@ case "$TARGET" in
 
 CI)
   export MAVEN_OPTS="-Xmx1G -Xms128m"
+
   INITIAL_VERSION=`maven_expression "project.version"`
+  if [[ $INITIAL_VERSION =~ "-SNAPSHOT" ]]; then
+    set_maven_build_version $TRAVIS_BUILD_NUMBER
+  fi
 
   if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
     echo 'Analyse and trigger QA of master branch'
@@ -26,9 +30,6 @@ CI)
     # For this reason errors are ignored with "|| true"
     git fetch --unshallow || true
   
-    # Do not deploy a SNAPSHOT version but the release version related to this build
-    set_maven_build_version $TRAVIS_BUILD_NUMBER
-
     mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy sonar:sonar \
           -Pdeploy-sonarsource \
           -Dmaven.test.redirectTestOutputToFile=false \
@@ -40,14 +41,6 @@ CI)
   elif [[ "$TRAVIS_BRANCH" == "branch-"* ]] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
     echo 'release branch: trigger QA, no analysis'
 
-    if [[ $INITIAL_VERSION =~ "-SNAPSHOT" ]]; then
-      echo "======= Found SNAPSHOT version ======="
-      # Do not deploy a SNAPSHOT version but the release version related to this build
-      set_maven_build_version $TRAVIS_BUILD_NUMBER
-    else
-      echo "======= Found RELEASE version ======="
-    fi
-
     mvn deploy \
         -Pdeploy-sonarsource \
         -Dmaven.test.redirectTestOutputToFile=false \
@@ -56,8 +49,6 @@ CI)
   elif [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -n "${GITHUB_TOKEN:-}" ]; then
     echo 'Internal pull request: trigger QA and analysis'
 
-    set_maven_build_version $TRAVIS_BUILD_NUMBER
-
     mvn org.jacoco:jacoco-maven-plugin:prepare-agent deploy sonar:sonar \
         -Pdeploy-sonarsource \
         -Dmaven.test.redirectTestOutputToFile=false \
@@ -72,9 +63,7 @@ CI)
   else
     echo 'Feature branch or external pull request: no QA, no analysis'
 
-    # No need for Maven phase "install" as the generated JAR file does not need to be installed
-    # in Maven local repository. Phase "verify" is enough.
-    mvn verify \
+    mvn install \
         -Dmaven.test.redirectTestOutputToFile=false \
         -B -e -V
   fi