Interface BuildScanApi
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
background
(Consumer<? super BuildScanApi> action) Deprecated.Executes the given action in a background thread, allowing the current Maven work to continue.void
buildFinished
(Consumer<? super BuildResult> action) Deprecated.Registers a callback that is invoked when the build has finished, but before this extension stops accepting to be called.void
buildScanPublished
(Consumer<? super PublishedBuildScan> action) Deprecated.Registers a callback that is invoked when a build scan has been published successfully.void
capture
(Consumer<? super BuildScanCaptureSettings> action) Deprecated.Allows configuring what data will be captured as part of the build scan.void
executeOnce
(String identifier, Consumer<? super BuildScanApi> action) Deprecated.Executes the given action only once over the course of the Maven build execution.boolean
Deprecated.Whether it is acceptable to communicate with a build scan server with an untrusted SSL certificate.Deprecated.Allows configuring what data will be captured as part of the build scan.Deprecated.Allows registering functions for obfuscating certain identifying information within build scans.Deprecated.Returns the URL of the Gradle Enterprise server to which the build scans are published.Deprecated.The agreement of the Gradle Terms of Use specified undersetTermsOfServiceUrl(String)
.Deprecated.The location of the Gradle Terms of Use that are agreed to when creating a build scan.boolean
Deprecated.Please useBuildScanCaptureSettings.isGoalInputFiles()
boolean
Deprecated.void
Deprecated.Captures a named link for the current build.void
obfuscation
(Consumer<? super BuildScanDataObfuscation> action) Deprecated.Allows registering functions for obfuscating certain identifying information within build scans.void
Deprecated.Indicates that a build scan should be published at the end of the build, regardless of whether the build succeeded or failed.void
publishAlwaysIf
(boolean condition) Deprecated.Indicates that, if the given condition is true, a build scan should be published at the end of the build, regardless of whether the build succeeded or failed.void
Deprecated.Indicates that a build scan should be published only if-Dscan
is passed to the Maven invocation.void
Deprecated.Indicates that a build scan should be published at the end of the build, if and only if the build failed.void
publishOnFailureIf
(boolean condition) Deprecated.Indicates that, if the given condition is true, a build scan should be published at the end of the build, if and only if the build failed.void
setAllowUntrustedServer
(boolean allow) Deprecated.Specifies whether it is acceptable to communicate with a Gradle Enterprise server using an untrusted SSL certificate.void
setCaptureGoalInputFiles
(boolean capture) Deprecated.default void
Deprecated.Sets the URL of the Gradle Enterprise server to which the build scans are published.void
Deprecated.Sets the URL of the Gradle Enterprise server to which the build scans are published.void
setTermsOfServiceAgree
(String agree) Deprecated.Indicates whether the Gradle Terms of Use specified undersetTermsOfServiceUrl(String)
are agreed to.void
setTermsOfServiceUrl
(String termsOfServiceUrl) Deprecated.The location of the Gradle Terms of Use that are agreed to when creating a build scan.void
setUploadInBackground
(boolean uploadInBackground) Deprecated.Specifies whether to upload the build scan in background after the build has finished.void
Deprecated.Captures a tag for the current build.void
Deprecated.Captures a named value for the current build.
-
Method Details
-
tag
Deprecated.Captures a tag for the current build. The tag is not required to be unique for a given build.- Parameters:
tag
- the name of the tag, must not be null- Since:
- 1.0
-
value
Deprecated.Captures a named value for the current build. The name is not required to be unique for a given build.- Parameters:
name
- the name, must not be nullvalue
- the value, may be null- Since:
- 1.0
-
link
Deprecated.Captures a named link for the current build. The name is not required to be unique for a given build.- Parameters:
name
- the name, must not be nullurl
- the url, must not be null, must be a valid valid http:, https: or mailto: URL- Since:
- 1.0
-
background
Deprecated.Executes the given action in a background thread, allowing the current Maven work to continue.This method is useful for capturing values, tags and links that are expensive to compute. By capturing them in the background, Maven can continue doing other work, making your build faster.
For example, if you are capturing the Git commit ID as a custom value you should invoke Git in the background:
import org.eclipse.jgit.*; background(api -> { Git git = ... ObjectId objectId = git.getRepository().resolve("HEAD"); api.value("Git Commit ID", ObjectId.toString(objectId)); });
All background work will be completed before finishing the build and publishing the build scan.
Any errors that are thrown by the background action will be logged and captured in the build scan.
- Parameters:
action
- the action to execute in the background- Since:
- 1.2
-
buildFinished
Deprecated.Registers a callback that is invoked when the build has finished, but before this extension stops accepting to be called.- Parameters:
action
- the action to execute when the build has finished- Since:
- 1.2
-
buildScanPublished
Deprecated.Registers a callback that is invoked when a build scan has been published successfully.If
isUploadInBackground()
istrue
, the callback is invoked as early as possible, which is as soon as the Gradle Enterprise server provides a build scan URL, and before the actual upload to the server. This means that if the URL is accessed right away, it might not be available yet, as the build scan is still being transmitted and processed by the server.- Parameters:
action
- the action to execute when the build scan has been published successfully- Since:
- 1.2
-
setTermsOfServiceUrl
Deprecated.The location of the Gradle Terms of Use that are agreed to when creating a build scan.Configuration via the
gradle.scan.termsOfService.url
system property will always take precedence.- Parameters:
termsOfServiceUrl
- the location of the Gradle Terms of Use- Since:
- 1.2
-
getTermsOfServiceUrl
Deprecated.The location of the Gradle Terms of Use that are agreed to when creating a build scan.- Returns:
- the location of the Gradle Terms of Use
- Since:
- 1.2
-
setTermsOfServiceAgree
Deprecated.Indicates whether the Gradle Terms of Use specified undersetTermsOfServiceUrl(String)
are agreed to.Configuration via the
gradle.scan.termsOfService.accept
system property will always take precedence.- Parameters:
agree
- true if agreeing to the Gradle Terms of Use, false otherwise- Since:
- 1.2
-
getTermsOfServiceAgree
Deprecated.The agreement of the Gradle Terms of Use specified undersetTermsOfServiceUrl(String)
.- Returns:
- the agreement of the Gradle Terms of Use
- Since:
- 1.2
-
setServer
Deprecated.Sets the URL of the Gradle Enterprise server to which the build scans are published.- Parameters:
url
- the server URL- Since:
- 1.2
-
setServer
Deprecated.Sets the URL of the Gradle Enterprise server to which the build scans are published.- Parameters:
url
- the server URL- Since:
- 1.10.3
-
getServer
Deprecated.Returns the URL of the Gradle Enterprise server to which the build scans are published.- Returns:
- null when no enterprise server is configured
- Since:
- 1.2
-
setAllowUntrustedServer
void setAllowUntrustedServer(boolean allow) Deprecated.Specifies whether it is acceptable to communicate with a Gradle Enterprise server using an untrusted SSL certificate.The default (public) build scan server uses SSL certificates that are trusted by default by standard modern Java environments. If you are using a different build scan server via Gradle Enterprise, it may use an untrusted certificate. This may be due to the use of an internally provisioned or self-signed certificate.
In such a scenario, you can either configure the build JVM environment to trust the certificate, or call this method with
true
to disable verification of the server's identity. Alternatively, you may disable SSL completely for Gradle Enterprise installation but this is not recommended.Allowing communication with untrusted servers keeps data encrypted during transmission, but makes it easy for a man-in-the-middle to impersonate the intended server and capture data.
This value has no effect if a server is specified using the HTTP protocol (i.e. has SSL disabled).
- Parameters:
allow
- whether to allow communication with a HTTPS server with an untrusted certificate- Since:
- 1.2
-
getAllowUntrustedServer
boolean getAllowUntrustedServer()Deprecated.Whether it is acceptable to communicate with a build scan server with an untrusted SSL certificate.- Returns:
true
it is acceptable to communicate with a build scan server with an untrusted SSL certificate- Since:
- 1.2
-
publishAlways
void publishAlways()Deprecated.Indicates that a build scan should be published at the end of the build, regardless of whether the build succeeded or failed.- Since:
- 1.2
-
publishAlwaysIf
void publishAlwaysIf(boolean condition) Deprecated.Indicates that, if the given condition is true, a build scan should be published at the end of the build, regardless of whether the build succeeded or failed.- Parameters:
condition
- whether to publish- Since:
- 1.2
-
publishOnFailure
void publishOnFailure()Deprecated.Indicates that a build scan should be published at the end of the build, if and only if the build failed.- Since:
- 1.2
-
publishOnFailureIf
void publishOnFailureIf(boolean condition) Deprecated.Indicates that, if the given condition is true, a build scan should be published at the end of the build, if and only if the build failed.- Parameters:
condition
- whether to publish on failure- Since:
- 1.2
-
publishOnDemand
void publishOnDemand()Deprecated.Indicates that a build scan should be published only if-Dscan
is passed to the Maven invocation.- Since:
- 1.2
-
setUploadInBackground
void setUploadInBackground(boolean uploadInBackground) Deprecated.Specifies whether to upload the build scan in background after the build has finished.Defaults to
true
.This allows the build to finish sooner, but can be problematic in build environments that terminate as soon as the build is finished as the upload may be terminated before it completes. Background uploading should be disabled for such environments.
This property may also be set in gradle-enterprise.xml or via the
gradle.scan.uploadInBackground
system property, which if set takes precedence over any value set by this method and the default. If this is set to any value other thantrue
, the background build scan upload will be disabled.This method cannot be called after the MavenSession has been started (i.e. after the
ExecutionEvent.Type.SessionStarted
event has been received). Doing so will produce a build time error.- Parameters:
uploadInBackground
- whether to upload the build scan in background- Since:
- 1.5
-
isUploadInBackground
boolean isUploadInBackground()Deprecated.- Returns:
- whether to upload build scan in background
- Since:
- 1.5
-
setCaptureGoalInputFiles
Deprecated.Specifies whether to capture information about each file used as an input to a goal execution.Defaults to
false
.Enabling this feature may increase the size of the build scan data. This requires more time to transmit to the server, and more storage space at the server. Most builds will not incur a noticeable difference when this feature is enabled. Large builds may increase the build scan data by a handful of megabytes. For most builds, the increase will be negligible.
If using Gradle Enterprise with a good connection to the server this capture should be enabled, as it allows comparing goal inputs at a file level when comparing builds.
This property may also be set in gradle-enterprise.xml or via the
gradle.scan.captureGoalInputFiles
system property. If this is set to any value other thanfalse
, the capture will be enabled. If this is set tofalse
, the capture will be disabled. If the capture is enabled or disabled via system property, calling this method has no effect. That is, the system property takes precedence over the value set via this method.This method cannot be called after the MavenSession has been started (i.e. after the
ExecutionEvent.Type.SessionStarted
event has been received). Doing so will produce a build time error.- Parameters:
capture
- whether to capture information about each file use as an input to a goal execution- Since:
- 1.2
-
isCaptureGoalInputFiles
Deprecated.Please useBuildScanCaptureSettings.isGoalInputFiles()
- Returns:
- whether information about each file used as an input to a goal will be captured
- Since:
- 1.2
-
executeOnce
Deprecated.Executes the given action only once over the course of the Maven build execution.The identifier is used to uniquely identify a given action. Calling this API a second time with the same identifier will not run the action again.
Any errors that are thrown by the action will be logged and captured in the build scan. In case of a failure while executing the action for a given identifier, no other action will be executed for the same identifier.
- Parameters:
identifier
- a unique identifieraction
- the action to execute only once- Since:
- 1.2.3
-
getObfuscation
BuildScanDataObfuscation getObfuscation()Deprecated.Allows registering functions for obfuscating certain identifying information within build scans.- Returns:
- the register of obfuscation functions
- Since:
- 1.3.1
-
obfuscation
Deprecated.Allows registering functions for obfuscating certain identifying information within build scans.- Parameters:
action
- a function to be applied to the register of obfuscation functions- Since:
- 1.3.1
-
getCapture
BuildScanCaptureSettings getCapture()Deprecated.Allows configuring what data will be captured as part of the build scan.- Returns:
- the capture settings
- Since:
- 1.11
-
capture
Deprecated.Allows configuring what data will be captured as part of the build scan.- Parameters:
action
- a function to be applied to the capture settings- Since:
- 1.11
-
BuildScanApi