Skip to content

Maven extension that enhances published build scans by adding a set of tags, links and custom values that have proven to be useful for many projects building with Develocity.

License

Notifications You must be signed in to change notification settings

gradle/common-custom-user-data-maven-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

This repository is maintained by the Develocity Solutions team, as one of several publicly available repositories:

Common Custom User Data Maven Extension

Verify Build Maven Central Revved up by Develocity

The Common Custom User Data Maven extension for Develocity enhances published build scans by adding a set of tags, links and custom values that have proven to be useful for many projects building with Develocity.

You can leverage this extension for your project in one of two ways:

  1. Apply the published extension directly in your .mvn/extensions.xml and immediately benefit from enhanced build scans
  2. Copy this repository and develop a customized version of the extension to standardize Develocity usage across multiple projects

Applying the published extension

The Common Custom User Data Maven extension is available in Maven Central. This extension requires the Develocity Maven extension to also be applied in your build in order to have an effect.

In order for the Common Custom User Data Maven extension to become active, you need to register it in the .mvn/extensions.xml file in your root project. The extensions.xml file is the same file where you have already declared the Develocity Maven extension.

See here for an example.

Version compatibility

This table details the version compatibility of the Common Custom User Data Maven extension with the Develocity Maven extension.

Common Custom User Data Maven extension versions Develocity Maven extension versions
1.8+ 1.11+
1.7 - 1.7.3 1.10.1+
1.3 - 1.6 1.6.5+
1.0 - 1.2 1.0+

The above chart captures the minimum compatible versions. For the best experience with the Develocity Maven extension 1.21 or higher, we recommend using the Common Custom User Data Maven extension 2.0 or higher.

Captured data

The additional tags, links and custom values captured by this extension include:

  • A tag representing the operating system
  • A tag representing how the build was invoked, be that from your IDE (IDEA, Eclipse) or from the command-line
  • A tag representing builds run on CI, together with a set of tags, links and custom values specific to the CI server running the build
  • For Git repositories, information on the commit id, branch name, status, and whether the checkout is dirty or not

See CustomBuildScanEnhancements.java for details on what data is captured and under which conditions.

Capturing additional tags, links and values in your build scans

You can apply additional configuration beyond what is contributed by the Common Custom User Data Maven extension by default. The additional configuration happens in a specific Groovy script. This is a good intermediate step before creating your own extension.

The Common Custom User Data Maven extension checks for a .mvn/develocity-custom-user-data.groovy or .mvn/gradle-enterprise-custom-user-data.groovy Groovy script in your root project. If the file exists, it evaluates the script with the following bindings:

See here for an example.

Developing a customized version of the extension

For more flexibility, we recommend creating a copy of this repository so that you may develop a customized version of the extension and publish it internally for your projects to consume.

This approach has a number of benefits:

  • Tailor the build scan enhancements to exactly the set of tags, links and custom values you require
  • Standardize the configuration for connecting to Develocity and the remote build cache in your organization, removing the need for each project to specify this configuration

If your customized extension provides all required Develocity configuration, then a consumer project will get all the benefits of Develocity simply by applying the extension. The project sources provide a good template to get started with your own extension.

Refer to the Javadoc for more details on the key types available for use.

Changelog

Refer to the release history to see detailed changes on the versions.

Breaking API changes

When updating to the Common Custom User Data Maven extension 2.0, please take care of the following.

  1. Rename the .mvn/gradle-enterprise-custom-user-data.groovy to .mvn/develocity-custom-user-data.groovy.
  2. Use BuildScanApiAdapter instead of BuildScanApi. See the example below:

gradle-enterprise-custom-user-data.groovy

import com.gradle.maven.extension.api.scan.BuildScanApi

buildScan.executeOnce('top-level-project') { BuildScanApi buildScanApi -> }

develocity-custom-user-data.groovy

import com.gradle.develocity.agent.maven.adapters.BuildScanApiAdapter

buildScan.executeOnce('top-level-project') { BuildScanApiAdapter buildScanApi -> }

Learn more

Visit our website to learn more about Develocity.

License

The Develocity Common Custom User Data Maven extension is open-source software released under the Apache 2.0 License.

About

Maven extension that enhances published build scans by adding a set of tags, links and custom values that have proven to be useful for many projects building with Develocity.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks