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

readMavenPom / writeMavenPom does not preserve comments and formatting

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

          [JENKINS-41902] readMavenPom / writeMavenPom does not preserve comments and formatting

          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 ?

          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 ?

          koller b added a comment - - edited

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

          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 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" } }

          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

          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

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

              Created:
              Updated: