Version: 5.0.1
Update: The individual package managers are no longer actively maintained. This functionality has been replaced by Synopsys Detect. |
The Hub Gradle plugin provides the ability to generate a Black Duck I/O formatted file containing the dependency information gathered from the Gradle project. The file is generated in either the specified folder, or defaults to the root of the project. This plugin also has the ability to upload the Black Duck I/O file up to the Hub to create a code location in the Hub. To generate the file and upload the contents to the Hub, the build.gradle file must have a section for this plugin, and execute tasks specific to this plugin. As a Hub and Gradle user, the Hub Gradle plugin enables you to configure your environment to connect to the Hub server.
Note: This documentation assumes that you have familiarity with Gradle and how to use it. For more information about Gradle, refer to: https://docs.gradle.org/current/userguide/plugins.html |
Software Requirements
The installation instructions in this document assume that you have the following installed and configured on your system:
The Gradle plugin is supported on the same operating systems and browsers as Black Duck Hub.
Network Requirements
The Hub Gradle plugin requires internet connectivity. The machine that hosts your Gradle server must be able to connect to the Hub server.
Before you install the Hub Gradle plugin, ensure that:
This section provides a simple configuration that can be used to get the Hub Gradle plugin up and running with the fewest number of steps. The steps include:
For Hub Gradle plugin versions 4.0 and higher, you can configure your Gradle build script using the following process.
To configure the Gradle build script:
Add the following to the top of your build.gradle file.
buildscript { repositories { mavenCentral() } dependencies { classpath group: 'com.blackducksoftware.integration', name: 'hub-gradle-plugin', version: 'x.x.x' } } apply plugin: 'com.blackducksoftware.hub' buildBom; hubUrl = 'http://localhost:8080' hubUsername = 'username' hubPassword = 'password' } |
For Hub Gradle versions 4.0.0 and higher, you can configure your Hub Gradle task using the following process.
To configure the Hub Gradle task:
For Hub Gradle plugin versions 4.0.0 and higher, you can run your Hub Gradle plugin task using the following command.
gradle buildBom |
As of Black Duck Hub Gradle plugin version 5.0.0 and higher, you can invoke the Hub Gradle plugin using a script parameter.
Info: This eliminates the need to edit your build.gradle file. |
To invoke the Hub Gradle plugin using a script parameter:
Add the following lines to the init.gradle file:
initscript { repositories { mavenCentral() } dependencies { classpath 'com.blackducksoftware.integration:hub-gradle-plugin:+' } } rootProject { apply plugin: com.blackducksoftware.integration.gradle.HubGradlePlugin } |
Then, run the command:
gradle --init-script init.gradle buildBom |
If your build.gradle file contains a buildscript section, then the steps are similar to the previous section. This section describes the changes in this scenario. The revised steps include:
In the buildscript section of the build.gradle file, verify that the dependencies section is present and includes:
dependencies { classpath group: 'com.blackducksoftware.integration', name: 'hub-gradle-plugin', version: 'x.x.x' } |
For Hub Gradle plugin versions 4.0 and higher, you can apply and configure your Hub Gradle plugin using the following process.
To apply and configure your Hub Gradle plugin:
Add the following to your build.gradle file after the buildscripts section.
buildscript { . . . } apply plugin: 'com.blackducksoftware.hub' buildBom { hubUrl = 'http://localhost:8080' hubUsername = 'username' hubPassword = 'password' } |
Add the following task properties to your build.gradle file.
Note: When using the Hub Gradle plugin on the command line, you can override property values by using the -P and -D switches. |
blackduck_hubIgnoreFailure = true blackduck_hubCodeLocationName = OverrideCodeLocationName blackduck_hubProjectName = OverrideMavenProjectName blackduck_hubVersionName = OverrideMavenProjectVersion blackduck_hubUrl = http://YourHubUrl:8080 blackduck_hubUsername = admin blackduck_hubPassword = password blackduck_hubTimeout = 120 blackduck_hubProxyHost = ProxyHost blackduck_hubProxyPort = 3128 blackduck_hubNoProxyHosts = .*google.* blackduck_hubProxyUsername = proxyUser blackduck_hubProxyPassword = proxypassword blackduck_createFlatDependencyList = false blackduck_createHubBdio = true blackduck_deployHubBdio = false blackduck_checkPolicies = true |
Changes in Release 5.0.2
Changes in Release 5.0.1
Changes in Release 5.0.0
Changes in Release 4.0.0
Changes in Release 3.4.1
Changes in Release 3.4.0
Changes in Release 3.3.0
Changes in Release 3.2.0
Changes in Release 3.1.0
Changes in Release 2.0.7