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.

How do I get serial communication to work with jRxTx or RXTX?

Many of our software components depend on the Java library RXTX (Copyright 1997-2004 by Trent Jarvi) for accessing the serial port (UART).  Currently we are moving our projects to jRxTx which is a wrapper of RXTX written by us. jRxTx has many advantages over RXTX such an improved API, OSGi capability, hosting on maven central etc.

In addition to the new API jRxTx provides the legacy RXTX API as well. So even if you use one of our libraries that still depend on RXTX you can use jRxTx with them. Checkout the README on github for instructions on how to set up jRxTx on your system.