Typing Return Value of readMavenPom Causes ClassCastException

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

XMLWordPrintable

      import org.apache.maven.model.Model
      
      Model mavenProject = readMavenPom(file: pom)
      

      The above groovy script causes a ClassCastException when executing a Pipeline script:

      [Pipeline] echo
      Marking build as failure due to the following error: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'com.foo:bar-api:jar:0.6.1-201612151515.0777507' with class 'org.apache.maven.model.Model' to class 'org.apache.maven.model.Model'
      [Pipeline] stage
      

            Assignee:
            Unassigned
            Reporter:
            Tim Eapen
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: