Skip to content

DaniilShmelev/diff

Repository files navigation

Build your code using Gradle in Azure Pipelines

Parameters for Gradle build task are explained below

  • Gradle Wrapper : This is a Required field. The location in the repository of the gradlew wrapper used for the build. Note that on Windows build agents (including the hosted pool), you must use the gradlew.bat wrapper. Xplat build agents use the gradlew shell script. To Know more click here

  • Options : Specify any command line options you want to pass to the Gradle wrapper. To know more click here

  • Goal(s) : The task(s) for Gradle to execute. A list of tasks can be taken from gradlew tasks issued from a command prompt. To know more click here

JUnit Test Results

Use the next three options to manage your JUnit test results in Azure Pipelines

  • Publish to Azure Pipelines : Select this option to publish JUnit Test results produced by the Gradle build to Azure Pipelines/TFS. Each test result file matching Test Results Files will be published as a test run in Azure Pipelines.

  • Test Results Files : This option will appear if you select the above option. Here, provide Test results files path. Wildcards can be used. For example, **/TEST-*.xml for all xml files whose name starts with TEST-."

  • Test Run Title : This option will appear if you select the Publish to Azure Pipelines/TFS option. Here provide a name for the Test Run

Code Coverage

Use the next options to manage your code coverage options. If your Build file already has Code Coverage enabled, you can ignore this section and use the Publish Code Coverage task to upload results to TFS/Azure Pipelines

  • CodeCoverage Tool : Select the code coverage tool you want to use. Currently JaCoCo and Cobertura are supported.

  • Class Inclusion/Exclusion Filters : This option is enabled only when you select one tool in the above option. Provide a comma separated list of filters to include or exclude classes from collecting code coverage. For example: +:com.,+:org.,-:my.app*.*.

Advanced

Use the next options to manage your JAVA_HOME attribute by JDK Version and Path

  • Working Directory : Directory on the build agent where the Gradle wrapper will be invoked from. Defaults to the repository root.

  • Set JAVA_HOME by : Select to set JAVA_HOME either by providing a path or let Azure Pipelines set the JAVA_HOME based on JDK version choosen. By default it is set to JDK Version

  • JDK Version : Here provide the PATH to JAVA_HOME if you want to set it by path or select the appropriate JDK version.

  • JDK Architecture : Select the approriate JDK Architecture. By default it is set to x86

Code Analysis

  • Run SonarQube Analysis : You can choose to run SonarQube analysis after executing the current goals. 'install' or 'package' goals should be executed first. To know more about this option click here

  • Run Checkstyle : You can choose to run the Checkstyle static code analysis tool, which checks the compliance of your source code with coding rules. You will receive a code analysis report with the number of violations detected, as well as the original report files if there were any violations.

  • Run PMD : You can choose to run the PMD static code analysis tool, which examines your source code for possible bugs. You will receive a code analysis report with the number of violations detected, as well as the original report files if there were any violations.

  • Run FindBugs : You can choose to run the FindBugs static code analysis tool, which examines the bytecode of your program for possible bugs. You will receive a code analysis report with the number of violations detected, as well as the original report files if there were any violations.

Q&A

How do I generate a wrapper from my Gradle project?

The Gradle wrapper allows the build agent to download and configure the exact Gradle environment that is checked into the repository without having any software configuration on the build agent itself other than the JVM.

  • 1. Create the Gradle wrapper by issuing the following command from the root project directory where your build.gradle resides: jamal@fabrikam> gradle wrapper

  • 2. Upload your Gradle wrapper to your remote repository.

There is a binary artifact that is generated by the gradle wrapper (located at gradle/wrapper/gradle-wrapper.jar). This binary file is small and doesn't require updating. If you need to change the Gradle configuration run on the build agent, you update the gradle-wrapper.properties.

The repository should look something like this:

|-- gradle/
    `-- wrapper/
        `-- gradle-wrapper.jar
        `-- gradle-wrapper.properties
|-- src/
|-- .gitignore
|-- build.gradle
|-- gradlew
|-- gradlew.bat

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published