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

readMavenPom / writeMavenPom does not preserve comments and formatting

    XMLWordPrintable

Details

    Description

      When you use readMavenPom / writeMavenPom in a build pipeline, the comments and formatting of the pom.xml file are not preserved.

      Attachments

        Activity

          I am facing the same issue, the formatting is changed once the pom is written using "writeMavenPom" from the Jenkinsfile.

          Are there any updated on this issues ?

          anbreensh Ambreen Sheikh added a comment - I am facing the same issue, the formatting is changed once the pom is written using "writeMavenPom" from the Jenkinsfile. Are there any updated on this issues ?
          kollerb04 koller b added a comment - - edited

          Also facing this issue, comments are wiped out when using writeMavenPom

          kollerb04 koller b added a comment - - edited Also facing this issue, comments are wiped out when using writeMavenPom

          Confirming the issue. Here is a quick way to reproduce it:

          node() {
           stage("Maven POMs test") {
             sh 'curl -s -o junit-4.12.pom -X GET https://search.maven.org/remotecontent?filepath=junit/junit/4.12/junit-4.12.pom'
             def pom = readMavenPom file: "junit-4.12.pom"
             writeMavenPom model: pom, file: "pom.xml"
             sh "diff -qr pom.xml junit-4.12.pom"
           }
          }
          stevan Stevan Cvetkovic added a comment - Confirming the issue. Here is a quick way to reproduce it: node() { stage( "Maven POMs test" ) { sh 'curl -s -o junit-4.12.pom -X GET https: //search.maven.org/remotecontent?filepath=junit/junit/4.12/junit-4.12.pom' def pom = readMavenPom file: "junit-4.12.pom" writeMavenPom model: pom, file: "pom.xml" sh "diff -qr pom.xml junit-4.12.pom" } }
          oswaldodiaz Oswaldo Diaz added a comment -

          Same issue here, I'm using this plugin to update pom version automatically and when writing on pom it's using 2 spaces indentation instead of 4

          oswaldodiaz Oswaldo Diaz added a comment - Same issue here, I'm using this plugin to update pom version automatically and when writing on pom it's using 2 spaces indentation instead of 4

          People

            rsandell rsandell
            jpraet Jimmy Praet
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated: