Skip to content

Commit

Permalink
Using Stax2 (Woodstox) instead of plexus-xml (Xpp) to process XML doc…
Browse files Browse the repository at this point in the history
…uments; reimplemented the mutable reader using an XMLStreamReader2, added some cleanup and more documentation. (#1174)
  • Loading branch information
andrzejj0 authored Nov 5, 2024
1 parent 8f48640 commit a899699
Show file tree
Hide file tree
Showing 54 changed files with 1,262 additions and 1,580 deletions.
17 changes: 12 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@
<doxiaVersion>1.12.0</doxiaVersion>
<doxia-sitetoolsVersion>1.11.1</doxia-sitetoolsVersion>
<mockitoVersion>4.11.0</mockitoVersion>
<woodstoxVersion>7.1.0</woodstoxVersion>
<stax2ApiVersion>4.2.2</stax2ApiVersion>

<!-- dotted property can not be used in .vm -->
<pluginVersion>${project.version}</pluginVersion>
Expand Down Expand Up @@ -186,6 +188,16 @@
<artifactId>maven-compat</artifactId>
<version>${mavenVersion}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>${woodstoxVersion}</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>${stax2ApiVersion}</version>
</dependency>

<dependency>
<groupId>org.apache.maven.resolver</groupId>
Expand Down Expand Up @@ -274,11 +286,6 @@
<artifactId>plexus-interactivity-api</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>7.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* @author Stephen Connolly
* @since 1.0-beta-1
*/
class PropertyVersionsBuilder {
public class PropertyVersionsBuilder {
private final String name;

private final String profileId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import org.apache.maven.model.Model;
import org.apache.maven.plugin.logging.Log;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import org.codehaus.mojo.versions.rewriting.MutableXMLStreamReader;

/**
* Created by IntelliJ IDEA.
Expand All @@ -32,11 +32,11 @@
public abstract class AbstractVersionChanger implements VersionChanger {
private final Model model;

private final ModifiedPomXMLEventReader pom;
private final MutableXMLStreamReader pom;

protected final Log log;

public AbstractVersionChanger(Model model, ModifiedPomXMLEventReader pom, Log log) {
public AbstractVersionChanger(Model model, MutableXMLStreamReader pom, Log log) {
this.model = model;
this.pom = pom;
this.log = log;
Expand All @@ -46,7 +46,7 @@ public Model getModel() {
return model;
}

public ModifiedPomXMLEventReader getPom() {
public MutableXMLStreamReader getPom() {
return pom;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.maven.plugin.logging.Log;
import org.codehaus.mojo.versions.api.PomHelper;
import org.codehaus.mojo.versions.api.change.DependencyVersionChange;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import org.codehaus.mojo.versions.rewriting.MutableXMLStreamReader;

/**
* Created by IntelliJ IDEA.
Expand All @@ -31,7 +31,7 @@
*/
public class DependencyVersionChanger extends AbstractVersionChanger {

public DependencyVersionChanger(Model model, ModifiedPomXMLEventReader pom, Log reporter) {
public DependencyVersionChanger(Model model, MutableXMLStreamReader pom, Log reporter) {
super(model, pom, reporter);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
import org.apache.maven.plugin.logging.Log;
import org.codehaus.mojo.versions.api.PomHelper;
import org.codehaus.mojo.versions.api.change.DependencyVersionChange;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import org.codehaus.mojo.versions.rewriting.MutableXMLStreamReader;

/**
*
*/
public class ParentVersionChanger extends AbstractVersionChanger {

public ParentVersionChanger(Model model, ModifiedPomXMLEventReader pom, Log reporter) {
public ParentVersionChanger(Model model, MutableXMLStreamReader pom, Log reporter) {
super(model, pom, reporter);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.maven.plugin.logging.Log;
import org.codehaus.mojo.versions.api.PomHelper;
import org.codehaus.mojo.versions.api.change.DependencyVersionChange;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import org.codehaus.mojo.versions.rewriting.MutableXMLStreamReader;

/**
* Created by IntelliJ IDEA.
Expand All @@ -31,7 +31,7 @@
*/
public class PluginVersionChanger extends AbstractVersionChanger {

public PluginVersionChanger(Model model, ModifiedPomXMLEventReader pom, Log reporter) {
public PluginVersionChanger(Model model, MutableXMLStreamReader pom, Log reporter) {
super(model, pom, reporter);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.maven.plugin.logging.Log;
import org.codehaus.mojo.versions.api.PomHelper;
import org.codehaus.mojo.versions.api.change.DependencyVersionChange;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import org.codehaus.mojo.versions.rewriting.MutableXMLStreamReader;

/**
* Created by IntelliJ IDEA.
Expand All @@ -31,7 +31,7 @@
*/
public class ProjectVersionChanger extends AbstractVersionChanger {

public ProjectVersionChanger(Model model, ModifiedPomXMLEventReader pom, Log reporter) {
public ProjectVersionChanger(Model model, MutableXMLStreamReader pom, Log reporter) {
super(model, pom, reporter);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import org.apache.maven.model.Model;
import org.apache.maven.plugin.logging.Log;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import org.codehaus.mojo.versions.rewriting.MutableXMLStreamReader;

/**
* Created by IntelliJ IDEA.
Expand All @@ -35,7 +35,7 @@
public class VersionChangerFactory {
private Model model = null;

private ModifiedPomXMLEventReader pom = null;
private MutableXMLStreamReader pom = null;

private Log log = null;

Expand All @@ -47,11 +47,11 @@ public synchronized void setModel(Model model) {
this.model = model;
}

public synchronized ModifiedPomXMLEventReader getPom() {
public synchronized MutableXMLStreamReader getPom() {
return pom;
}

public synchronized void setPom(ModifiedPomXMLEventReader pom) {
public synchronized void setPom(MutableXMLStreamReader pom) {
this.pom = pom;
}

Expand Down
Loading

0 comments on commit a899699

Please sign in to comment.