Build steps for Gradle project in TeamCity

We have already seen all important settings of a typical build configurations. All settings in the build configurations are similar like general settings, VCS, triggers, failure conditions. What differs is the build steps. For different projects, we have to provide different build steps.

In this topic, we are going to look at build steps for a gradle project in TeamCity.

In build steps section, click on add a build step and select the gradle runner as shown in below image.

Gradle runners needs 2 very important settings.

  1. build file – By default, it is build.gradle But you can change it as per your requirement.
  2. task – any valid task name. You can find the list of commonly used tasks on gradle tasks article. Here we have mentioned clean build task.
gradle clean build task in TeamCity

gradle clean build task in TeamCity

If you want to measure code coverage, you can use any of the available code coverage tool provided by IntelliJ IDEA or JaCoCo.

Below image shows the sample gradle build output.

gradle build log in TeamCity

gradle build log in TeamCity

 

You may also like...