The following examples show a few ways in which a GradleBuild step can be configured. For more information about GradleBuild Pipeline steps, see GradleBuild.
Using Default Values
The most basic form of GradleBuild. Uses all default values. This step will navigate to the root of the repo specified in the inputResources array, and run the specified Gradle command.
GradleBuild
pipelines: - name: gradleBuildPipeline steps: - name: gradleBuildStep type: GradleBuild configuration: gradleCommand: "build" inputResources: - name: gitRepoResource integrations: - name: artifactory_integration
Source Location is a Sub-directory of Git Repo
A more complicated GradleBuild step, in this one the source location is a subdirectory of the GitRepo (gradle-example-minimal) and the project uses the Gradle Artifactory Plugin. Resolver and deployer repositories have also been configured, resolving from maven-remote and deploying to gradle-local.
GradleBuild
pipelines: - name: gradleBuildPipeline steps: - name: gradleBuildStep type: GradleBuild configuration: gradleCommand: "artifactoryPublish clean -b build.gradle" sourceLocation: gradle-example-minimal deployerRepo: gradle-local resolverRepo: maven-remote usesPlugin: true inputResources: - name: gitRepoResource integrations: - name: artifactory_integration
Using Config File
This GradleBuild step is similar to the previous example, but has aconfig file committed to the repository as gradle-example-minimal/gradle-art-config. The config file contains the repository and plugin settings.
GradleBuild
pipelines: - name: gradleBuildPipeline steps: - name: gradleBuildStep type: GradleBuild configuration: gradleCommand: "artifactoryPublish clean -b build.gradle" sourceLocation: gradle-example-minimal configFileLocation: . configFileName: gradle-art-config inputResources: - name: gitRepoResource integrations: - name: artifactory_integration
Publish Build Info and Trigger Xray Scan
In this example, build info is published as part of the GradleBuild step and an Xray scan is triggered.
GradleBuild
pipelines: - name: gradleBuildPipeline steps: - name: gradleBuildStep type: GradleBuild configuration: gradleCommand: "build" autoPublishBuildInfo: true forceXrayScan: true inputResources: - name: gitRepoResource integrations: - name: artifactory_integration outputResources: - name: myBuildInfo