[ 
https://issues.apache.org/jira/browse/MNG-6801?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Liana Lupsa updated MNG-6801:
-----------------------------
    Description: 
Context: 
 We are using pipeline-utility-steps-plugin which is a jenkins plugin which 
uses the following classes:
 
[https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/ReadMavenPomStep.java].
 
[https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/WriteMavenPomStep.java#L32]
 In our Jenkins file we have a stage that overwrites the version in the pom 
with the computed version and for this we need pipeline-utility-steps-plugin.

The problem is that the tags in the pom.xml are never retained in the same 
order. The elements in the pom file are completelly rearranged.
 For consistency reasons and idempotency we need to retain the structure and 
simply update one line.

Status:
 After evaluating the plugin code we noticed that it uses: 
 
[https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/WriteMavenPomStep.java#L32]
 and imports:
 import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
 with 
[https://maven.apache.org/ref/3.3.9/maven-model/apidocs/src-html/org/apache/maven/model/io/xpp3/MavenXpp3Writer.html]
 which uses 
 XmlSerializer serializer = new MXSerializer();
 
[https://github.com/sonatype/plexus-utils/blob/master/src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java]
 We think that maven XmlSerializer causes this problem.

Example of the pom.xml changes:

first build trigger:

run 1:
<properties>
 <javax.version>3.1.0</javax.version>
 <mockito.version>1.10.19</mockito.version>
 <hamcrest.version>2.1</hamcrest.version>
 <openam.version>6.5.1</openam.version>
 <lombok.version>1.18.6</lombok.version>
 <junit.version>4.12</junit.version>
 </properties>

run 2:
<properties>
 <mockito.version>1.10.19</mockito.version>
 <javax.version>3.1.0</javax.version>
 <hamcrest.version>2.1</hamcrest.version>
 <openam.version>6.5.1</openam.version>
 <lombok.version>1.18.6</lombok.version>
 <junit.version>4.12</junit.version>
 </properties>
​and run 3: 
<properties>
 <javax.version>3.1.0</javax.version>
 <mockito.version>1.10.19</mockito.version>
 <hamcrest.version>2.1</hamcrest.version>
 <openam.version>6.5.1</openam.version>
 <lombok.version>1.18.6</lombok.version>
 <junit.version>4.12</junit.version>
 </properties>

  was:
Context: 
We are using pipeline-utility-steps-plugin which is a jenkins plugin which uses 
the following classes:
https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/ReadMavenPomStep.java.
https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/WriteMavenPomStep.java#L32
In our Jenkins file we have a stage that overwrites the version in the pom with 
the computed version and for this we need pipeline-utility-steps-plugin.

The problem is that the tags in the pom.xml are never retained in the same 
order. The elements in the pom file are completelly rearranged.
For consistency reasons and idempotency we need to retain the structure and 
simply update one line.

Status:
After evaluating the plugin code we noticed that it uses: 
https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/WriteMavenPomStep.java#L32
and imports:
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
with 
https://maven.apache.org/ref/3.3.9/maven-model/apidocs/src-html/org/apache/maven/model/io/xpp3/MavenXpp3Writer.html
which uses 
XmlSerializer serializer = new MXSerializer();
https://github.com/sonatype/plexus-utils/blob/master/src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java
We think that maven XmlSerializer causes this problem.


Example of the pom.xml changes:

first build trigger:

<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>

second build trigger:

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

 


> MavenXpp3Writer doesn't retain structure
> ----------------------------------------
>
>                 Key: MNG-6801
>                 URL: https://issues.apache.org/jira/browse/MNG-6801
>             Project: Maven
>          Issue Type: Bug
>          Components: Plugins and Lifecycle
>            Reporter: Liana Lupsa
>            Priority: Major
>
> Context: 
>  We are using pipeline-utility-steps-plugin which is a jenkins plugin which 
> uses the following classes:
>  
> [https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/ReadMavenPomStep.java].
>  
> [https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/WriteMavenPomStep.java#L32]
>  In our Jenkins file we have a stage that overwrites the version in the pom 
> with the computed version and for this we need pipeline-utility-steps-plugin.
> The problem is that the tags in the pom.xml are never retained in the same 
> order. The elements in the pom file are completelly rearranged.
>  For consistency reasons and idempotency we need to retain the structure and 
> simply update one line.
> Status:
>  After evaluating the plugin code we noticed that it uses: 
>  
> [https://github.com/jenkinsci/pipeline-utility-steps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/pipeline/utility/steps/maven/WriteMavenPomStep.java#L32]
>  and imports:
>  import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
>  with 
> [https://maven.apache.org/ref/3.3.9/maven-model/apidocs/src-html/org/apache/maven/model/io/xpp3/MavenXpp3Writer.html]
>  which uses 
>  XmlSerializer serializer = new MXSerializer();
>  
> [https://github.com/sonatype/plexus-utils/blob/master/src/main/java/org/codehaus/plexus/util/xml/pull/MXSerializer.java]
>  We think that maven XmlSerializer causes this problem.
> Example of the pom.xml changes:
> first build trigger:
> run 1:
> <properties>
>  <javax.version>3.1.0</javax.version>
>  <mockito.version>1.10.19</mockito.version>
>  <hamcrest.version>2.1</hamcrest.version>
>  <openam.version>6.5.1</openam.version>
>  <lombok.version>1.18.6</lombok.version>
>  <junit.version>4.12</junit.version>
>  </properties>
> run 2:
> <properties>
>  <mockito.version>1.10.19</mockito.version>
>  <javax.version>3.1.0</javax.version>
>  <hamcrest.version>2.1</hamcrest.version>
>  <openam.version>6.5.1</openam.version>
>  <lombok.version>1.18.6</lombok.version>
>  <junit.version>4.12</junit.version>
>  </properties>
> ​and run 3: 
> <properties>
>  <javax.version>3.1.0</javax.version>
>  <mockito.version>1.10.19</mockito.version>
>  <hamcrest.version>2.1</hamcrest.version>
>  <openam.version>6.5.1</openam.version>
>  <lombok.version>1.18.6</lombok.version>
>  <junit.version>4.12</junit.version>
>  </properties>



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to