The work on this software project is in no way associated with my employer nor with the role I'm having at my employer. Any requests for changes will be decided upon exclusively by myself based on my personal preferences. I maintain this project as much or as little as my spare time permits.
TeamCity plugin that integrates with Build Scan for Gradle and Maven. Build scans are available as a free service on scans.gradle.com and commercially via Gradle Enterprise.
For each Gradle and Maven build that is run from TeamCity, this plugin exposes the links to the created build scans in the TeamCity UI. The plugin can also be configured to instrument Gradle and Maven with Gradle Enterprise.
The plugin is available from the JetBrains Marketplace.
Recent Build Scan: https://gradle.com/s/yevfzaz2bvvh4
Find out more about Build Scan for Gradle and Maven at https://scans.gradle.com and https://gradle.com.
These plugin versions require that you use at least Gradle Enterprise Gradle plugin 3.0 or Gradle Build Scan plugin 1.8 in your Gradle builds, or Gradle Enterprise Maven extension 1.0 in your Maven builds.
These plugin versions require that you use at least Gradle Enterprise Gradle plugin 3.0 or Gradle Build Scan plugin 1.8 in your Gradle builds, or Gradle Enterprise Maven extension 1.11 in your Maven builds.
It is recommended that you use the latest Gradle Enterprise Gradle plugin version or latest Gradle Build Scan plugin version and the latest Gradle Enterprise Maven extension version at all times to get the most insights from your builds.
If you use TeamCity's Gradle runner to launch your Gradle builds, there is nothing special to do.
If you use TeamCity's Command Line runner to launch your Gradle builds, you can opt in to enable build scan detection using the buildScanPlugin.command-line-build-step.enabled
configuration parameter.
If the first two mechanisms will not work for your Gradle build configurations, you can still get integration with build scans, but it requires your build logs being parsed for build scan links. In case of huge build logs, this can put a significant toll on the performance of your TeamCity instance. You can enable the parsing of the build logs using the buildScanPlugin.log-parsing.enabled
configuration paramter.
If you use TeamCity's Maven runner to launch Maven builds, there is nothing special to do.
If you use TeamCity's Command Line runner to launch your Maven builds, you can opt in to enable build scan detection using the buildScanPlugin.command-line-build-step.enabled
configuration parameter.
If the first two mechanisms will not work for your Maven build configurations, you can still get integration with build scans, but it requires your build logs being parsed for build scan links. In case of huge build logs, this can put a significant toll on the performance of your TeamCity instance. You can enable the parsing of the build logs using the buildScanPlugin.log-parsing.enabled
configuration paramter.
- Go to the plugin list of your TeamCity installation at
<TeamCityInstanceRootUrl>/admin/admin.html?item=plugins
and browse the plugins repository. - Select, install, and activate the plugin as described here.
-
Download the plugin
.zip
file from https://plugins.jetbrains.com/plugin/9326-integration-for-gradle-and-maven-build-scans. -
Go to the plugin list of your TeamCity installation at
<TeamCityInstanceRootUrl>/admin/admin.html?item=plugins
and click on the link Upload plugin zip to install the previously downloaded plugin.zip
file. -
Restart TeamCity.
-
Trigger your Gradle builds with build scans enabled.
-
Find the links of the published build scans in the Overview section of each TeamCity build.
You can have the Gradle Enterprise Gradle plugin and the Gradle Enterprise Maven extension automatically injected into your Gradle and Maven builds when the builds are run via TeamCity's Gradle or Maven runner. If a Gradle or Maven build is run via TeamCity's Command Line runner the auto-injection can be opted in to. If a given build is already connected to Gradle Enterprise, the auto-injection is skipped.
The same auto-injection behavior is available for the Common Custom User Data Gradle plugin and the Common Custom User Data Maven extension.
The higher in TeamCity's project hierarchy the required configuration parameters are applied, the more widely they apply since the configuration parameters are passed on to all child projects. Child projects can override the configuration parameters and even disable the auto-injection by setting the appropriate configuration parameters to empty values.
For convenience, the configuration parameter values can be defined through a Gradle Enterprise connection, as explained below.
A Gradle Enterprise connection is created in the Connections section of the configuration of a given project. In the Add Connection dropdown, select the Gradle Enterprise connection type.
Fill out the Add Connection dialog with the URL for the Gradle Enterprise instance, any plugin or extension versions to be applied, and any other fields in the dialog as needed. Some values, such as the plugin and extension versions, will be pre-populated.
A Gradle Enterprise connection can be created on any project and is automatically inherited by all its child projects.
Note: For Gradle, the Common Custom User Data Gradle plugin must be at least version 1.7 or newer.
Note: For Maven, the Gradle Enterprise Maven extension and the Common Custom User Data Maven extension are currently hard-coded to versions 1.15.4 and 1.11.1, respectively.
It is possible to inject Gradle Enterprise by manually setting configuration parameters. Click for more details.
-
In TeamCity, on the build configuration for which you want to apply Gradle Enterprise, create three configuration parameters:
buildScanPlugin.gradle-enterprise.url
- the URL of the Gradle Enterprise instance to which to publish the Build ScanbuildScanPlugin.gradle-enterprise.plugin.version
- the version of the Gradle Enterprise Gradle plugin to applybuildScanPlugin.ccud.plugin.version
- the version of the Common Custom User Data Gradle plugin to apply (optional)
-
If required, provide additional configuration parameters for your environment (optional):
buildScanPlugin.gradle-enterprise.allow-untrusted-server
- allow communication with an untrusted server; set to true if your Gradle Enterprise instance is using a self-signed certificatebuildScanPlugin.gradle.plugin-repository.url
- the URL of the repository to use when resolving the GE and CCUD plugins; required if your TeamCity agents are not able to access the Gradle Plugin PortalbuildScanPlugin.command-line-build-step.enabled
- enable Gradle Enterprise integration for Command Line build steps; by default only steps using the Gradle runner are enabledbuildScanPlugin.log-parsing.enabled
- use log parsing to extract Build Scan urls (if the default mechanism for capturing Build Scan links is not working)
-
Trigger your Gradle build.
-
Find the links of the published build scans in the Overview section of each TeamCity build.
Note: For Gradle, the Common Custom User Data Gradle plugin must be at least version 1.7 or newer.
-
In TeamCity, on the build configuration for which you want to integrate Gradle Enterprise, create three configuration parameters:
buildScanPlugin.gradle-enterprise.url
- the URL of the Gradle Enterprise instance to which to publish the Build ScanbuildScanPlugin.gradle-enterprise.extension.version
- the version of the Gradle Enterprise Maven extension to applybuildScanPlugin.ccud.extension.version
- the version of the Common Custom User Data Maven extension to apply (optional)
-
If required, provide additional configuration parameters for your environment (optional):
buildScanPlugin.gradle-enterprise.allow-untrusted-server
- allow communication with an untrusted server; set to true if your Gradle Enterprise instance is using a self-signed certificatebuildScanPlugin.gradle-enterprise.extension.custom.coordinates
- the coordinates of a custom extension that has a transitive dependency on the Gradle Enterprise Maven ExtensionbuildScanPlugin.ccud.extension.custom.coordinates
- the coordinates of a custom Common Custom User Data Maven Extension or of a custom extension that has a transitive dependency on itbuildScanPlugin.maven-version-check.enabled
- enable a Maven version check to ensure that the Gradle Enterprise Maven Extension is not applied to Maven builds lower than version 3.3.1buildScanPlugin.command-line-build-step.enabled
- enable Gradle Enterprise integration for Command Line build steps; by default only steps using the Maven runner are enabledbuildScanPlugin.log-parsing.enabled
- use log parsing to extract Build Scan urls (if the default mechanism for capturing Build Scan links is not working)
-
Trigger your Maven build.
-
Find the links of the published build scans in the Overview section of each TeamCity build.
Note: For Maven, the Gradle Enterprise Maven extension and the Common Custom User Data Maven extension are currently hard-coded to versions 1.15.4 and 1.11.1, respectively.
-
In Slack, create a webhook and keep track of the created URL.
-
In TeamCity, on the build configuration for which you want to be notified about published build scans, create a configuration parameter with name
buildScanPlugin.slack-webhook.url
and the value being the URL of the webhook created in step #1. -
Trigger your Gradle builds with build scans enabled.
-
Find a notification about the published build scans in the Slack channel configured in the webhook.
Both feedback and contributions are very welcome.
- bigdaz (several prs related to the Gradle Enterprise integration)
- clayburn (several prs related to the Gradle Enterprise integration)
- marcphilipp (pr #53 that adds Gradle 4/5 compatibility to the Gradle Enterprise integration)
- ldaley (pr #53 that adds Gradle 4/5 compatibility to the Gradle Enterprise integration)
- madlexa (pr #47 that adds TeamCity 2022.04 compatibility)
- facewindu (pr #21 that includes init script test coverage)
- dmitry-treskunov (bug report and proposed fix)
- pbielicki (pr #17 that adds a hint to the BuildScanServiceMessageMavenExtension @Component)
- jonnybbb (pr #14 and #15 that store build scan links under artifacts and clean up legacy data)
- davidburstromspotify (bug report and proposed fix)
- guylabs (pr #10 that provides support for the Gradle Enterprise Gradle plugin)
- autonomousapps (pr #9 that provides build scans for Maven builds)
- mark-vieira (pr #6 that provides message service functionality)
- pavelsher (several code pointers)
This plugin is available under the Apache License, Version 2.0.
(c) by Etienne Studer