writeMavenPom throws class cast exception when creating a new pom file

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Creation of a pom file from a pipeline

      node ('master') {
          Model pom = new Model()
          pom.artifactId = 'my-test-project'
          pom.groupId = 'com.example.jenkins.test'
          pom.version = '1.1-SNAPSHOT'
          writeMavenPom(pom)
      }
      

      using writeMavenPom fails with:

      [Pipeline] End of Pipeline
      java.lang.ClassCastException: org.jenkinsci.plugins.pipeline.utility.steps.maven.WriteMavenPomStep.model expects class org.apache.maven.model.Model but received class org.apache.maven.model.Model
      

      However, reading and existing pom, making modifications and writing those to a file works like a charm.
      Test case for writeMavenPom (https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/test/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/WriteMavenPomStepTest.java) passes, but it is using an older version of pipeline dependencies.

            Assignee:
            rsandell
            Reporter:
            Janis Balodis
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: