Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71413

Detect plugin incorrectly adds backslash before = and space in value of detect property detect.maven.build.command

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • Jenkins 2.401.1
      Synopsys Detect plugin Version 8.0.0
      Freestyle project

      Setting the Detect property detect.maven.build.command in the Detect Properties section fails, because the plugin adds backslash '\' before equals '=' and space ' ' in the value:

      Contents of Detect Properties:

      --detect.project.name=TRW --detect.project.version.name=Vx-x-trw-dev-configproviderutils-pom --detect.code.location.name="trw-blackduck-detect-javacommons_configuration_config-provider_pom" --detect.tools=DETECTOR --detect.accuracy.required=NONE --detect.source.path=${WORKSPACE}/javacommons/configuration/config-provider --detect.maven.build.command="-Dmaven.repo.local=${WORKSPACE}/.m2/repository -Dscope=runtime"

       

      Values seen at runtime – note the spurious backslash characters in detect.maven.build.command's value:

      2023-06-07 17:55:21 EDT INFO  [main] — blackduck.proxy.port = 0 [env] 
      2023-06-07 17:55:21 EDT INFO  [main] — blackduck.trust.cert = true [env] 
      2023-06-07 17:55:21 EDT INFO  [main] — blackduck.url = https://blackduck.abinitio.com [env] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.accuracy.required = NONE [cmd] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.code.location.name = trw-blackduck-detect-javacommons_configuration_config-provider_pom [cmd] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.maven.build.command = -Dmaven.repo.local\=/disk1/sand/jenkins/workspace/blackduck-detect-javacommons_configuration_config-provider_pom/.m2/repository\ -Dscope\=runtime [cmd] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.phone.home.passthrough.jenkins.plugin.version = 8.0.0 [cmd] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.phone.home.passthrough.jenkins.version = 2.401.1 [cmd] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.project.name = TRW [cmd] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.project.version.name = Vx-x-trw-dev-configproviderutils-pom [cmd] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.source.path = /disk1/sand/jenkins/workspace/blackduck-detect-javacommons_configuration_config-provider_pom/javacommons/configuration/config-provider [cmd] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.timeout = 120 [env] 
      2023-06-07 17:55:21 EDT INFO  [main] — detect.tools = DETECTOR [cmd] 
      2023-06-07 17:55:21 EDT INFO  [main] — logging.level.com.synopsys.integration = INFO [cmd] 

      The mvn command fails:

      2023-06-07 17:55:22 EDT INFO  [main] — Running executable >/ab/tools/PLAT/common/apache-maven-3.6.3/bin/mvn -Dmaven.repo.local\=/disk1/sand/jenkins/workspace/blackduck-detect-javacommons_configuration_config-provider_pom/.m2/repository\ -Dscope\=runtime dependency:tree -T1
      2023-06-07 17:55:23 EDT INFO  [main] — Process return code: 1
      2023-06-07 17:55:23 EDT INFO  [main] — Standard Output: 
      2023-06-07 17:55:23 EDT INFO  [main][ERROR] Could not create local repository at /u/build/.m2/repository -> [Help 1]

      Tried different quoting of the value (single quotes, double quotes, single quotes surrounded by double quotes), but the plugin always inserts the backslashes.

       

      Workaround:

      Set detect.maven.build.command using the environment variable DETECT_MAVEN_BUILD_COMMAND in the Jenkins job General section (https://sig-product-docs.synopsys.com/bundle/integrations-detect/page/configuring/envvars.html):

      DETECT_MAVEN_BUILD_COMMAND="-Dmaven.repo.local=${WORKSPACE}/.m2/repository -Dscope=runtime"

      The mvn command succeeds:

      2023-06-07 17:48:29 EDT INFO  [main] — detect.maven.build.command = "-Dmaven.repo.local=/disk1/sand/jenkins/workspace/blackduck-detect-javacommons_configuration_config-provider_pom/.m2/repository -Dscope=runtime" [env] 
      {{}}

      ...

      2023-06-07 17:48:30 EDT INFO  [main] — Running executable >/ab/tools/PLAT/common/apache-maven-3.6.3/bin/mvn -Dmaven.repo.local=/disk1/sand/jenkins/workspace/blackduck-detect-javacommons_configuration_config-provider_pom/.m2/repository -Dscope=runtime dependency:tree -T1
      2023-06-07 17:48:44 EDT INFO  [main] — Process return code: 0

       

       

            jrichard James Richard
            fdavis99 Franklin
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: