How to get started with Gradle?

We use the Gradle build automation tool in all of our projects. Our distributions all contain fully functional Gradle build files (build.gradle). Thus if you changed code and want to rebuild a library you can do it easily with Gradle. Also if you want to import our software into Eclipse you can easily create Eclipse project files using Gradle. Our projects also contain the Gradle wrapper. You may either use the Gradle wrapper (gradlew) in the root of the project or you may install Gradle on your system.  Just follow these instructions:

Install Gradle (optionally if not using the Gradle wrapper):

  • Download the latest Gradle from the website: https://gradle.org/
  • Add bin directory of Gradle to the user/system PATH:
    • in Unix systems: add export PATH=$PATH:/home/<user>/<path>/<gradle-version>/bin to ~/.bashrc
    • in Windows follow these instructions
  • Gradle will automatically download the project dependencies from Maven Central. Therefore if you’re behind a proxy you should set the proxy options in the gradle.properties file as explained here.
Install a Java JDK >= 8
  • We use minimum OpenJDK 8 to compile our projects. If you have several JDKs installed you may want to set the org.gradle.java.home property in the gradle.properties file.

Create Eclipse project files using Gradle:

  • with the command gradle eclipse or ./gradlew eclipse you can generate Eclipse project files
  • After generating the Eclipse project files, you can import the project into a Eclipse workspace
  • It is important to add the GRADLE_USER_HOME variable in Eclipse: Window->Preferences->Java->Build Path->Classpath Variable. Set it to the path of the ~/.gradle folder in your home directory (e.g. /home/<user_name>/.gradle/ (Unix) or C:\Users\<user_name>\.gradle\ (Windows))

Rebuild a library:

  • After you have modified the code you can completely rebuild the code using the command gradle build.This will also execute the JUnit tests or generate the javadoc and manual files.
  • Run gradle tasks to get a list of all Gradle tasks
  • You can also assemble a new distribution tar file: the command gradle clean tar will build everything and put a new distribution file in the folder <project_root>/build/distribution.
de_DE