blackducksoftware / hub-gradle-plugin

Hub Gradle: Create BOMs, check policies - all from your gradle build.
Apache License 2.0
0 stars 5 forks source link

Setting hubProjectName Causes Failure #29

Closed vjkoskela closed 7 years ago

vjkoskela commented 7 years ago

It appears that when setting the project name that the file output name is changed, but this causes the plugin to fail. Removing the hubProjectName parameter allows the upload to succeed; however, we don't want to use the default project name.

Version: 'com.blackducksoftware.integration:hub-gradle-plugin:5.0.1'

Settings:

    buildBom {
        hubUrl = 'https://hubqualtrics.blackducksoftware.com'
        hubUsername = 'automation'
        hubPassword = '<REDACTED>'
        hubProjectName = "${project.group}.${project.archivesBaseName}"
        hubIgnoreFailure = true
    }

Output:

Could not deploy the file to the Hub, check the logs for specific issues: Failed to import Bom file: /Users/villek/Workspace/data-relocation-service/build/blackduck/service_bdio.jsonld to the Hub with Error : File '/Users/villek/Workspace/data-relocation-service/build/blackduck/service_bdio.jsonld' does not exist
org.gradle.api.GradleException: Could not deploy the file to the Hub, check the logs for specific issues: Failed to import Bom file: /Users/villek/Workspace/data-relocation-service/build/blackduck/service_bdio.jsonld to the Hub with Error : File '/Users/villek/Workspace/data-relocation-service/build/blackduck/service_bdio.jsonld' does not exist
        at com.blackducksoftware.integration.gradle.task.BuildBomTask.deployHubBDIO(BuildBomTask.java:243)
        at com.blackducksoftware.integration.gradle.task.BuildBomTask.performTask(BuildBomTask.java:153)
        at com.blackducksoftware.integration.gradle.task.BuildBomTask.task(BuildBomTask.java:130)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)

And the directory contents in question:

$ ls -l /Users/villek/Workspace/data-relocation-service/build/blackduck/
total 48
-rw-r--r--  1 villek  staff    30 Jun 28 11:37 blackDuckHubProjectName.txt
-rw-r--r--  1 villek  staff    14 Jun 28 11:37 blackDuckHubProjectVersionName.txt
-rw-r--r--  1 villek  staff  6959 Jun 28 11:37 com.qualtrics.core.drs.core_bdio.jsonld
-rw-r--r--  1 villek  staff  7306 Jun 28 11:37 com.qualtrics.core.drs.service_bdio.jsonld

So it seems that the plugin is respecting the project name for generating the file but for some reason then looks for the file name without the customized name. I am not able to reproduce the problem with the 4.0.0 version of the plugin so this seems like a regression with the 5.0.1 version.

psantos1113 commented 7 years ago

I am able to reproduce the problem here in house and I'm looking into it. I understand what the cause is.

psantos1113 commented 7 years ago

Addressed with the commit: https://github.com/blackducksoftware/hub-gradle-plugin/commit/f432928069958e1470b4572a74bbdb6300d778f8

Will be in the next release of the plugin 5.0.2

psantos1113 commented 7 years ago

Released 5.0.2 of the gradle plugin containing the fix