Last active
April 24, 2018 17:31
-
-
Save JMBattista/f1ade1921d678695d300 to your computer and use it in GitHub Desktop.
Upgrade Gradle Codeship
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Allows using different Gradle versions with http://codeship.io | |
# | |
# As @altfatterz points out below this isn't necessary if you choose to check in your .gradle and gradlew.bat/gradlew.sh files. | |
# I prefer not to check-in the generated files so I set this up. | |
# | |
# We update the path here instead of via the environment variables because you cannot control the order | |
# that environment variables are set in the Environment tab, and this results in the path NOT having the version number | |
# see test_commands for info on how to run gradle without settings the path here if you want to avoid it. | |
# | |
# Codeship defaults to jdk7, so you may also want to run the following command to switch to jdk8 | |
# jdk_switcher use oraclejdk8 | |
PATH=$GRADLE_HOME/bin:$PATH | |
wget -N $GRADLE_URL | |
mkdir -p ~/gradle | |
unzip $GRADLE.zip -d ~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# If you don't want to update the path as part of the setup commands you can instead call gralde using: | |
# $GRADLE_HOME/bin/gradle check --info | |
# I prefer to update the path and simplify the | |
gradle check --info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We set the GRADLE_VERSION as its own environment variable here as it gets referenced in two places. | |
# This allows us to easily upgrade our gradle version. (Tested going from 2.1 to 3.1) | |
GRADLE_VERSION=3.1 | |
GRADLE_HOME=/home/rof/gradle-$GRADLE_VERSION | |
GRADLE=gradle-$GRADLE_VERSION-bin | |
GRADLE_URL=https://services.gradle.org/distributions/$GRADLE.zip |
With the new dependency cache
http://blog.codeship.com/dependency-cache-sphinx-codeship/
the zip will be downloaded each time.
Why not use the gradle wrapper approach? Although with this is as well, the ~/.gradle is not kept
For future users: remember that Codeship uses Java 7 by default.
use
jdk_switcher use oraclejdk8
to change it to Java 8.
Great! It really helped me here, thanks!
Still works for Gradle 3.1 (if version is adjusted in command). Thanks!
Still works for Gradle 4.0.
Add --console=plain to your gradle command to generate console output that is readable as this was changed in gradle 4.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Still working as of December 10th, 2014 -- thanks!