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

Maven metadata plugin does not work with jenkins pipeline

    XMLWordPrintable

Details

    Description

      Maven metadata plugin does not work with jenkins pipeline

      env vars are never set

      Attachments

        Issue Links

          Activity

            Workaround to access the properties anyway:

            ...
            // currently not possible, so workaround used:
            // String version = params.COMPONENT_VERSION
            String version = currentBuild.rawBuild.getAction(hudson.model.ParametersAction).getParameter("COMPONENT").version
            ...
            
            torstenreinhard Torsten Reinhard added a comment - Workaround to access the properties anyway: ... // currently not possible, so workaround used: // String version = params.COMPONENT_VERSION String version = currentBuild.rawBuild.getAction(hudson.model.ParametersAction).getParameter( "COMPONENT" ).version ...

            improvement to get it working, even if "COMPONENT_VERSION" will be passed as String parameter from an upstream project:

            String getVersion( String parameterName ) {
                def action = currentBuild.rawBuild.getAction(hudson.model.ParametersAction)
            
                // try to get the value directly if passed as String from an upstream job    
                StringParameterValue passed = (StringParameterValue)action.getParameter("${parameterName}_VERSION")
                if( passed != null ) {
                    return passed.getValue()        
                }
                
                // get the version property directly from Maven MetaDataPlugin
                return action.getParameter(parameterName).version
            }
            
            torstenreinhard Torsten Reinhard added a comment - improvement to get it working, even if "COMPONENT_VERSION" will be passed as String parameter from an upstream project: String getVersion( String parameterName ) { def action = currentBuild.rawBuild.getAction(hudson.model.ParametersAction) // try to get the value directly if passed as String from an upstream job StringParameterValue passed = (StringParameterValue)action.getParameter( "${parameterName}_VERSION" ) if ( passed != null ) { return passed.getValue() } // get the version property directly from Maven MetaDataPlugin return action.getParameter(parameterName).version }

            Hi,

            I submitted a PR to fix that bug : see https://github.com/jenkinsci/maven-metadata-plugin/pull/13 

            P.S. : torstenreinhard's work-around did not work for me (action was null).

            bbonnet Benjamin BONNET added a comment - Hi, I submitted a PR to fix that bug : see https://github.com/jenkinsci/maven-metadata-plugin/pull/13   P.S. :  torstenreinhard 's work-around did not work for me (action was null).

            Code changed in jenkins
            User: Benjamin BONNET
            Path:
            src/main/lombok/eu/markov/jenkins/plugin/mvnmeta/MavenMetadataParameterValue.java
            http://jenkins-ci.org/commit/maven-metadata-plugin/ac3b6f65c4ff7d9a5d5acf054fa1e84ddf3487bd
            Log:
            Return param value to pipeline

            see https://issues.jenkins-ci.org/browse/JENKINS-38619

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Benjamin BONNET Path: src/main/lombok/eu/markov/jenkins/plugin/mvnmeta/MavenMetadataParameterValue.java http://jenkins-ci.org/commit/maven-metadata-plugin/ac3b6f65c4ff7d9a5d5acf054fa1e84ddf3487bd Log: Return param value to pipeline see https://issues.jenkins-ci.org/browse/JENKINS-38619

            Code changed in jenkins
            User: Marc Rohlfs
            Path:
            src/main/lombok/eu/markov/jenkins/plugin/mvnmeta/MavenMetadataParameterValue.java
            src/test/java/eu/markov/jenkins/plugin/mvnmeta/MavenMetadataParameterDefinitionTest.java
            http://jenkins-ci.org/commit/maven-metadata-plugin/b6febe082a523f8ef217aa1693b1540d6b6c1822
            Log:
            Merge pull request #13 from bonnetb/patch-1

            JENKINS-38619(https://issues.jenkins-ci.org/browse/JENKINS-38619)

            Compare: https://github.com/jenkinsci/maven-metadata-plugin/compare/04f8423d627f...b6febe082a52

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Marc Rohlfs Path: src/main/lombok/eu/markov/jenkins/plugin/mvnmeta/MavenMetadataParameterValue.java src/test/java/eu/markov/jenkins/plugin/mvnmeta/MavenMetadataParameterDefinitionTest.java http://jenkins-ci.org/commit/maven-metadata-plugin/b6febe082a523f8ef217aa1693b1540d6b6c1822 Log: Merge pull request #13 from bonnetb/patch-1 JENKINS-38619 ( https://issues.jenkins-ci.org/browse/JENKINS-38619 ) Compare: https://github.com/jenkinsci/maven-metadata-plugin/compare/04f8423d627f...b6febe082a52
            marcrohlfs Marc Rohlfs added a comment -

            Released with version 2.0.0

            marcrohlfs Marc Rohlfs added a comment - Released with version 2.0.0

            People

              marcrohlfs Marc Rohlfs
              m4rkmckenna Mark McKenna
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: