diff --git a/apache-maven/src/assembly/component.xml b/apache-maven/src/assembly/component.xml
index 24378449d0a6..6d9809c4b5c3 100644
--- a/apache-maven/src/assembly/component.xml
+++ b/apache-maven/src/assembly/component.xml
@@ -31,7 +31,6 @@ under the License.
liborg.codehaus.plexus:plexus-classworlds
- org.codehaus.plexus:plexus-utils
diff --git a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java b/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java
index 810446186e35..c6474a1b58d6 100644
--- a/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java
+++ b/maven-compat/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java
@@ -18,11 +18,9 @@
*/
package org.apache.maven.usability.plugin;
-import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
@@ -31,7 +29,6 @@
import java.util.Map;
import org.apache.maven.usability.plugin.io.xpp3.ParamdocXpp3Reader;
-import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
/**
@@ -100,11 +97,9 @@ public static Map load() throws ExpressionDocumentationExcep
*/
private static Map parseExpressionDocumentation(InputStream docStream)
throws IOException, XmlPullParserException {
- Reader reader = new BufferedReader(ReaderFactory.newXmlReader(docStream));
-
ParamdocXpp3Reader paramdocReader = new ParamdocXpp3Reader();
- ExpressionDocumentation documentation = paramdocReader.read(reader, true);
+ ExpressionDocumentation documentation = paramdocReader.read(docStream, true);
List expressions = documentation.getExpressions();
diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index 3c6f5bc35aab..1aed356c0236 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -129,7 +129,7 @@ under the License.
- org.apache.maven
+ org.codehaus.plexusplexus-utils
diff --git a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultModelXmlFactory.java b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultModelXmlFactory.java
index 4b67fd4c2f1b..7bfa586c5a42 100644
--- a/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultModelXmlFactory.java
+++ b/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultModelXmlFactory.java
@@ -39,7 +39,7 @@
import org.apache.maven.api.services.xml.XmlWriterRequest;
import org.apache.maven.model.v4.MavenXpp3ReaderEx;
import org.apache.maven.model.v4.MavenXpp3WriterEx;
-import org.codehaus.plexus.util.ReaderFactory;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
import static org.apache.maven.internal.impl.Utils.nonNull;
@@ -64,11 +64,11 @@ public Model read(@Nonnull XmlReaderRequest request) throws XmlReaderException {
MavenXpp3ReaderEx xml = new MavenXpp3ReaderEx();
xml.setAddDefaultEntities(request.isAddDefaultEntities());
if (path != null) {
- reader = ReaderFactory.newXmlReader(path.toFile());
+ reader = new XmlStreamReader(path.toFile());
} else if (url != null) {
- reader = ReaderFactory.newXmlReader(url);
+ reader = new XmlStreamReader(url);
} else if (inputStream != null) {
- reader = ReaderFactory.newXmlReader(inputStream);
+ reader = new XmlStreamReader(inputStream);
}
return xml.read(reader, request.isStrict(), source);
} catch (Exception e) {
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
index 47bb66dcf3fe..79308b5af3ff 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
@@ -29,7 +29,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
-import java.io.Reader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -101,7 +100,6 @@
import org.codehaus.plexus.configuration.PlexusConfiguration;
import org.codehaus.plexus.configuration.PlexusConfigurationException;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
-import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.graph.DependencyFilter;
@@ -267,10 +265,8 @@ private String getPluginDescriptorLocation() {
private PluginDescriptor parsePluginDescriptor(InputStream is, Plugin plugin, String descriptorLocation)
throws PluginDescriptorParsingException {
try {
- Reader reader = ReaderFactory.newXmlReader(is);
-
- return builder.build(reader, descriptorLocation);
- } catch (IOException | PlexusConfigurationException e) {
+ return builder.build(is, descriptorLocation);
+ } catch (PlexusConfigurationException e) {
throw new PluginDescriptorParsingException(plugin, descriptorLocation, e);
}
}
diff --git a/maven-model-builder/pom.xml b/maven-model-builder/pom.xml
index 1fbaee756a99..e0a864b08884 100644
--- a/maven-model-builder/pom.xml
+++ b/maven-model-builder/pom.xml
@@ -38,7 +38,7 @@ under the License.
4.0.0-alpha-6-SNAPSHOT
- org.apache.maven
+ org.codehaus.plexusplexus-utils
diff --git a/maven-model-transform/pom.xml b/maven-model-transform/pom.xml
index 8821ca7717ce..3a0a1e2dde60 100644
--- a/maven-model-transform/pom.xml
+++ b/maven-model-transform/pom.xml
@@ -29,8 +29,8 @@ under the License.
- org.apache.maven
- plexus-utils
+ org.codehaus.plexus
+ plexus-xmlorg.junit.jupiter
diff --git a/maven-model/pom.xml b/maven-model/pom.xml
index 01c1583f6adb..6e6016d4f33b 100644
--- a/maven-model/pom.xml
+++ b/maven-model/pom.xml
@@ -42,6 +42,10 @@ under the License.
maven-xml-impl4.0.0-alpha-6-SNAPSHOT
+
+ org.codehaus.plexus
+ plexus-xml
+
diff --git a/maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3ReaderEx.java b/maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3ReaderEx.java
index a72c00f9a9a2..ab557eb1fb30 100644
--- a/maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3ReaderEx.java
+++ b/maven-model/src/main/java/org/apache/maven/model/io/xpp3/MavenXpp3ReaderEx.java
@@ -24,7 +24,6 @@
import org.apache.maven.model.InputSource;
import org.apache.maven.model.Model;
-import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
import org.codehaus.plexus.util.xml.pull.MXParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
@@ -53,8 +52,6 @@ public boolean getAddDefaultEntities() {
} // -- boolean getAddDefaultEntities()
/**
- * @see ReaderFactory#newXmlReader
- *
* @param reader a reader object.
* @param strict a strict object.
* @throws IOException IOException if any.
@@ -70,8 +67,6 @@ public Model read(Reader reader, boolean strict, InputSource source) throws IOEx
} // -- Model read( Reader, boolean )
/**
- * @see ReaderFactory#newXmlReader
- *
* @param reader a reader object.
* @throws IOException IOException if any.
* @throws XmlPullParserException XmlPullParserException if
@@ -93,7 +88,10 @@ public Model read(Reader reader, InputSource source) throws IOException, XmlPull
* @return Model
*/
public Model read(InputStream in, boolean strict, InputSource source) throws IOException, XmlPullParserException {
- return read(ReaderFactory.newXmlReader(in), strict, source);
+ XmlPullParser parser =
+ addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser();
+ parser.setInput(in, null);
+ return read(parser, strict, source);
} // -- Model read( InputStream, boolean )
/**
@@ -106,7 +104,7 @@ public Model read(InputStream in, boolean strict, InputSource source) throws IOE
* @return Model
*/
public Model read(InputStream in, InputSource source) throws IOException, XmlPullParserException {
- return read(ReaderFactory.newXmlReader(in), source);
+ return read(in, true, source);
} // -- Model read( InputStream )
/**
diff --git a/maven-plugin-api/pom.xml b/maven-plugin-api/pom.xml
index 02a762d5c97b..e8a6ab56af58 100644
--- a/maven-plugin-api/pom.xml
+++ b/maven-plugin-api/pom.xml
@@ -45,7 +45,7 @@ under the License.
org.eclipse.sisu.plexus
- org.apache.maven
+ org.codehaus.plexusplexus-utils
diff --git a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
index 820793356e0b..7c853f97bdad 100644
--- a/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
+++ b/maven-plugin-api/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
@@ -19,6 +19,7 @@
package org.apache.maven.plugin.descriptor;
import java.io.IOException;
+import java.io.InputStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
@@ -44,6 +45,10 @@ public PluginDescriptor build(Reader reader, String source) throws PlexusConfigu
return build(source, buildConfiguration(reader));
}
+ public PluginDescriptor build(InputStream input, String source) throws PlexusConfigurationException {
+ return build(source, buildConfiguration(input));
+ }
+
private PluginDescriptor build(String source, PlexusConfiguration c) throws PlexusConfigurationException {
PluginDescriptor pluginDescriptor = new PluginDescriptor();
@@ -374,4 +379,12 @@ public PlexusConfiguration buildConfiguration(Reader configuration) throws Plexu
throw new PlexusConfigurationException(e.getMessage(), e);
}
}
+
+ public PlexusConfiguration buildConfiguration(InputStream configuration) throws PlexusConfigurationException {
+ try {
+ return XmlPlexusConfiguration.toPlexusConfiguration(XmlNodeBuilder.build(configuration, null));
+ } catch (IOException | XmlPullParserException e) {
+ throw new PlexusConfigurationException(e.getMessage(), e);
+ }
+ }
}
diff --git a/maven-repository-metadata/pom.xml b/maven-repository-metadata/pom.xml
index 3588ea63a9a6..dbfe66628902 100644
--- a/maven-repository-metadata/pom.xml
+++ b/maven-repository-metadata/pom.xml
@@ -33,8 +33,8 @@ under the License.
- org.apache.maven
- plexus-utils
+ org.codehaus.plexus
+ plexus-xmlorg.apache.maven.resolver
diff --git a/maven-resolver-provider/pom.xml b/maven-resolver-provider/pom.xml
index 0bb05af91db9..5d2774842ae9 100644
--- a/maven-resolver-provider/pom.xml
+++ b/maven-resolver-provider/pom.xml
@@ -69,7 +69,7 @@ under the License.
maven-resolver-impl
- org.apache.maven
+ org.codehaus.plexusplexus-utils
diff --git a/maven-settings-builder/pom.xml b/maven-settings-builder/pom.xml
index 6ffeb859ba1f..7dc9908c9a0b 100644
--- a/maven-settings-builder/pom.xml
+++ b/maven-settings-builder/pom.xml
@@ -52,7 +52,7 @@ under the License.
plexus-interpolation
- org.apache.maven
+ org.codehaus.plexusplexus-utils
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java
index 56508b8d3d43..fc96ad1a23ca 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsReader.java
@@ -25,12 +25,12 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.nio.file.Files;
import java.util.Map;
import java.util.Objects;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.v4.SettingsXpp3Reader;
-import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
/**
@@ -46,7 +46,11 @@ public class DefaultSettingsReader implements SettingsReader {
public Settings read(File input, Map options) throws IOException {
Objects.requireNonNull(input, "input cannot be null");
- return read(ReaderFactory.newXmlReader(input), options);
+ try (InputStream in = Files.newInputStream(input.toPath())) {
+ return new Settings(new SettingsXpp3Reader().read(in, isStrict(options)));
+ } catch (XmlPullParserException e) {
+ throw new SettingsParseException(e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e);
+ }
}
@Override
diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java
index 4f4a7b293120..e654eafb20eb 100644
--- a/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java
+++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/io/DefaultSettingsWriter.java
@@ -31,7 +31,7 @@
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.v4.SettingsXpp3Writer;
-import org.codehaus.plexus.util.WriterFactory;
+import org.codehaus.plexus.util.xml.XmlStreamWriter;
/**
* Handles serialization of settings into the default textual format.
@@ -49,7 +49,7 @@ public void write(File output, Map options, Settings settings) t
output.getParentFile().mkdirs();
- write(WriterFactory.newXmlWriter(output), options, settings);
+ write(new XmlStreamWriter(output), options, settings);
}
@Override
diff --git a/maven-settings/pom.xml b/maven-settings/pom.xml
index b9bb3c8f6272..c27963e9410e 100644
--- a/maven-settings/pom.xml
+++ b/maven-settings/pom.xml
@@ -43,8 +43,8 @@ under the License.
4.0.0-alpha-6-SNAPSHOT
- org.apache.maven
- plexus-utils
+ org.codehaus.plexus
+ plexus-xml
diff --git a/maven-settings/src/main/java/org/apache/maven/settings/io/xpp3/SettingsXpp3Reader.java b/maven-settings/src/main/java/org/apache/maven/settings/io/xpp3/SettingsXpp3Reader.java
index 75cbef3e583a..4bedb113e6a2 100644
--- a/maven-settings/src/main/java/org/apache/maven/settings/io/xpp3/SettingsXpp3Reader.java
+++ b/maven-settings/src/main/java/org/apache/maven/settings/io/xpp3/SettingsXpp3Reader.java
@@ -23,7 +23,6 @@
import java.io.Reader;
import org.apache.maven.settings.Settings;
-import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.EntityReplacementMap;
import org.codehaus.plexus.util.xml.pull.MXParser;
import org.codehaus.plexus.util.xml.pull.XmlPullParser;
@@ -52,8 +51,6 @@ public boolean getAddDefaultEntities() {
} // -- boolean getAddDefaultEntities()
/**
- * @see ReaderFactory#newXmlReader
- *
* @param reader a reader object.
* @param strict a strict object.
* @throws IOException IOException if any.
@@ -69,8 +66,6 @@ public Settings read(Reader reader, boolean strict) throws IOException, XmlPullP
} // -- Model read( Reader, boolean )
/**
- * @see ReaderFactory#newXmlReader
- *
* @param reader a reader object.
* @throws IOException IOException if any.
* @throws XmlPullParserException XmlPullParserException if
@@ -92,7 +87,10 @@ public Settings read(Reader reader) throws IOException, XmlPullParserException {
* @return Settings
*/
public Settings read(InputStream in, boolean strict) throws IOException, XmlPullParserException {
- return read(ReaderFactory.newXmlReader(in), strict);
+ XmlPullParser parser =
+ addDefaultEntities ? new MXParser(EntityReplacementMap.defaultEntityReplacementMap) : new MXParser();
+ parser.setInput(in, null);
+ return read(parser, strict);
} // -- Model read( InputStream, boolean )
/**
@@ -105,7 +103,7 @@ public Settings read(InputStream in, boolean strict) throws IOException, XmlPull
* @return Settings
*/
public Settings read(InputStream in) throws IOException, XmlPullParserException {
- return read(ReaderFactory.newXmlReader(in));
+ return read(in, true);
} // -- Model read( InputStream )
/**
diff --git a/maven-toolchain-builder/pom.xml b/maven-toolchain-builder/pom.xml
index 3695424d24ea..e63c26e8dcb8 100644
--- a/maven-toolchain-builder/pom.xml
+++ b/maven-toolchain-builder/pom.xml
@@ -44,7 +44,7 @@ under the License.
javax.inject
- org.apache.maven
+ org.codehaus.plexusplexus-utils
diff --git a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsReader.java b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsReader.java
index a361775b844c..6c6297fa6772 100644
--- a/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsReader.java
+++ b/maven-toolchain-builder/src/main/java/org/apache/maven/toolchain/io/DefaultToolchainsReader.java
@@ -25,12 +25,12 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
+import java.nio.file.Files;
import java.util.Map;
import java.util.Objects;
import org.apache.maven.toolchain.model.PersistedToolchains;
import org.apache.maven.toolchain.v4.MavenToolchainsXpp3Reader;
-import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
/**
@@ -47,7 +47,11 @@ public class DefaultToolchainsReader implements ToolchainsReader {
public PersistedToolchains read(File input, Map options) throws IOException {
Objects.requireNonNull(input, "input cannot be null");
- return read(ReaderFactory.newXmlReader(input), options);
+ try (InputStream in = Files.newInputStream(input.toPath())) {
+ return new PersistedToolchains(new MavenToolchainsXpp3Reader().read(in, isStrict(options)));
+ } catch (XmlPullParserException e) {
+ throw new ToolchainsParseException(e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e);
+ }
}
@Override
diff --git a/maven-toolchain-model/pom.xml b/maven-toolchain-model/pom.xml
index 02edf12bea00..f497f415a854 100644
--- a/maven-toolchain-model/pom.xml
+++ b/maven-toolchain-model/pom.xml
@@ -42,8 +42,8 @@ under the License.
4.0.0-alpha-6-SNAPSHOT
- org.apache.maven
- plexus-utils
+ org.codehaus.plexus
+ plexus-xml
diff --git a/maven-xml-impl/pom.xml b/maven-xml-impl/pom.xml
index 26853b322728..d0968531a2c2 100644
--- a/maven-xml-impl/pom.xml
+++ b/maven-xml-impl/pom.xml
@@ -41,8 +41,8 @@ under the License.
org.codehaus.plexus
- plexus-utils
- ${plexusUtilsVersionEmbedded}
+ plexus-xml
+ ${plexusXmlVersion}provided
diff --git a/maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java b/maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java
deleted file mode 100644
index b64a2d0cfea5..000000000000
--- a/maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/Xpp3Dom.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.plexus.util.xml;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.maven.api.xml.XmlNode;
-import org.apache.maven.internal.xml.XmlNodeImpl;
-import org.codehaus.plexus.util.xml.pull.XmlSerializer;
-
-/**
- * NOTE: remove all the util code in here when separated, this class should be pure data.
- */
-public class Xpp3Dom implements Serializable {
- private static final String[] EMPTY_STRING_ARRAY = new String[0];
-
- public static final String CHILDREN_COMBINATION_MODE_ATTRIBUTE = "combine.children";
-
- public static final String CHILDREN_COMBINATION_MERGE = "merge";
-
- public static final String CHILDREN_COMBINATION_APPEND = "append";
-
- /**
- * This default mode for combining children DOMs during merge means that where element names match, the process will
- * try to merge the element data, rather than putting the dominant and recessive elements (which share the same
- * element name) as siblings in the resulting DOM.
- */
- public static final String DEFAULT_CHILDREN_COMBINATION_MODE = CHILDREN_COMBINATION_MERGE;
-
- public static final String SELF_COMBINATION_MODE_ATTRIBUTE = "combine.self";
-
- public static final String SELF_COMBINATION_OVERRIDE = "override";
-
- public static final String SELF_COMBINATION_MERGE = "merge";
-
- public static final String SELF_COMBINATION_REMOVE = "remove";
-
- /**
- * This default mode for combining a DOM node during merge means that where element names match, the process will
- * try to merge the element attributes and values, rather than overriding the recessive element completely with the
- * dominant one. This means that wherever the dominant element doesn't provide the value or a particular attribute,
- * that value or attribute will be set from the recessive DOM node.
- */
- public static final String DEFAULT_SELF_COMBINATION_MODE = SELF_COMBINATION_MERGE;
-
- private ChildrenTracking childrenTracking;
- private XmlNode dom;
-
- public Xpp3Dom(String name) {
- this.dom = new XmlNodeImpl(name);
- }
-
- /**
- * @since 3.2.0
- * @param inputLocation The input location.
- * @param name The name of the Dom.
- */
- public Xpp3Dom(String name, Object inputLocation) {
- this.dom = new XmlNodeImpl(name, null, null, null, inputLocation);
- }
-
- /**
- * Copy constructor.
- * @param src The source Dom.
- */
- public Xpp3Dom(Xpp3Dom src) {
- this(src, src.getName());
- }
-
- /**
- * Copy constructor with alternative name.
- * @param src The source Dom.
- * @param name The name of the Dom.
- */
- public Xpp3Dom(Xpp3Dom src, String name) {
- this.dom = new XmlNodeImpl(src.dom, name);
- }
-
- public Xpp3Dom(XmlNode dom) {
- this.dom = dom;
- }
-
- public Xpp3Dom(XmlNode dom, Xpp3Dom parent) {
- this.dom = dom;
- this.childrenTracking = parent::replace;
- }
-
- public Xpp3Dom(XmlNode dom, ChildrenTracking childrenTracking) {
- this.dom = dom;
- this.childrenTracking = childrenTracking;
- }
-
- public XmlNode getDom() {
- return dom;
- }
-
- // ----------------------------------------------------------------------
- // Name handling
- // ----------------------------------------------------------------------
-
- public String getName() {
- return dom.getName();
- }
-
- // ----------------------------------------------------------------------
- // Value handling
- // ----------------------------------------------------------------------
-
- public String getValue() {
- return dom.getValue();
- }
-
- public void setValue(String value) {
- update(new XmlNodeImpl(dom.getName(), value, dom.getAttributes(), dom.getChildren(), dom.getInputLocation()));
- }
-
- // ----------------------------------------------------------------------
- // Attribute handling
- // ----------------------------------------------------------------------
-
- public String[] getAttributeNames() {
- return dom.getAttributes().keySet().toArray(EMPTY_STRING_ARRAY);
- }
-
- public String getAttribute(String name) {
- return dom.getAttribute(name);
- }
-
- /**
- *
- * @param name name of the attribute to be removed
- * @return true if the attribute has been removed
- * @since 3.4.0
- */
- public boolean removeAttribute(String name) {
- if (name != null && !name.isEmpty()) {
- Map attrs = new HashMap<>(dom.getAttributes());
- boolean ret = attrs.remove(name) != null;
- if (ret) {
- update(new XmlNodeImpl(
- dom.getName(), dom.getValue(), attrs, dom.getChildren(), dom.getInputLocation()));
- }
- return ret;
- }
- return false;
- }
-
- /**
- * Set the attribute value
- *
- * @param name String not null
- * @param value String not null
- */
- public void setAttribute(String name, String value) {
- if (null == value) {
- throw new NullPointerException("Attribute value can not be null");
- }
- if (null == name) {
- throw new NullPointerException("Attribute name can not be null");
- }
- Map attrs = new HashMap<>(dom.getAttributes());
- attrs.put(name, value);
- update(new XmlNodeImpl(dom.getName(), dom.getValue(), attrs, dom.getChildren(), dom.getInputLocation()));
- }
-
- // ----------------------------------------------------------------------
- // Child handling
- // ----------------------------------------------------------------------
-
- public Xpp3Dom getChild(int i) {
- return new Xpp3Dom(dom.getChildren().get(i), this);
- }
-
- public Xpp3Dom getChild(String name) {
- XmlNode child = dom.getChild(name);
- return child != null ? new Xpp3Dom(child, this) : null;
- }
-
- public void addChild(Xpp3Dom xpp3Dom) {
- List children = new ArrayList<>(dom.getChildren());
- children.add(xpp3Dom.dom);
- xpp3Dom.childrenTracking = this::replace;
- update(new XmlNodeImpl(dom.getName(), dom.getValue(), dom.getAttributes(), children, dom.getInputLocation()));
- }
-
- public Xpp3Dom[] getChildren() {
- return dom.getChildren().stream().map(d -> new Xpp3Dom(d, this)).toArray(Xpp3Dom[]::new);
- }
-
- public Xpp3Dom[] getChildren(String name) {
- return dom.getChildren().stream()
- .filter(c -> c.getName().equals(name))
- .map(d -> new Xpp3Dom(d, this))
- .toArray(Xpp3Dom[]::new);
- }
-
- public int getChildCount() {
- return dom.getChildren().size();
- }
-
- public void removeChild(int i) {
- List children = new ArrayList<>(dom.getChildren());
- children.remove(i);
- update(new XmlNodeImpl(dom.getName(), dom.getValue(), dom.getAttributes(), children, dom.getInputLocation()));
- }
-
- public void removeChild(Xpp3Dom child) {
- List children = new ArrayList<>(dom.getChildren());
- children.remove(child.dom);
- update(new XmlNodeImpl(dom.getName(), dom.getValue(), dom.getAttributes(), children, dom.getInputLocation()));
- }
-
- // ----------------------------------------------------------------------
- // Parent handling
- // ----------------------------------------------------------------------
-
- public Xpp3Dom getParent() {
- throw new UnsupportedOperationException();
- }
-
- public void setParent(Xpp3Dom parent) {}
-
- // ----------------------------------------------------------------------
- // Input location handling
- // ----------------------------------------------------------------------
-
- /**
- * @since 3.2.0
- * @return input location
- */
- public Object getInputLocation() {
- return dom.getInputLocation();
- }
-
- /**
- * @since 3.2.0
- * @param inputLocation input location to set
- */
- public void setInputLocation(Object inputLocation) {
- update(new XmlNodeImpl(dom.getName(), dom.getValue(), dom.getAttributes(), dom.getChildren(), inputLocation));
- }
-
- // ----------------------------------------------------------------------
- // Helpers
- // ----------------------------------------------------------------------
-
- public void writeToSerializer(String namespace, XmlSerializer serializer) throws IOException {
- // TODO: WARNING! Later versions of plexus-utils psit out an header due to thinking this is a new
- // document - not the desired behaviour!
- SerializerXMLWriter xmlWriter = new SerializerXMLWriter(namespace, serializer);
- Xpp3DomWriter.write(xmlWriter, this);
- if (xmlWriter.getExceptions().size() > 0) {
- throw (IOException) xmlWriter.getExceptions().get(0);
- }
- }
-
- /**
- * Merges one DOM into another, given a specific algorithm and possible override points for that algorithm.
- * The algorithm is as follows:
- *
- *
if the recessive DOM is null, there is nothing to do... return.
- *
Determine whether the dominant node will suppress the recessive one (flag=mergeSelf).
- *
- *
retrieve the 'combine.self' attribute on the dominant node, and try to match against 'override'...
- * if it matches 'override', then set mergeSelf == false...the dominant node suppresses the recessive one
- * completely.
- *
otherwise, use the default value for mergeSelf, which is true...this is the same as specifying
- * 'combine.self' == 'merge' as an attribute of the dominant root node.
- *
- *
If mergeSelf == true
- *
- *
if the dominant root node's value is empty, set it to the recessive root node's value
- *
For each attribute in the recessive root node which is not set in the dominant root node, set it.
- *
Determine whether children from the recessive DOM will be merged or appended to the dominant DOM as
- * siblings (flag=mergeChildren).
- *
- *
if childMergeOverride is set (non-null), use that value (true/false)
- *
retrieve the 'combine.children' attribute on the dominant node, and try to match against
- * 'append'...
- *
if it matches 'append', then set mergeChildren == false...the recessive children will be appended as
- * siblings of the dominant children.
- *
otherwise, use the default value for mergeChildren, which is true...this is the same as specifying
- * 'combine.children' == 'merge' as an attribute on the dominant root node.
- *
- *
Iterate through the recessive children, and:
- *
- *
if mergeChildren == true and there is a corresponding dominant child (matched by element name),
- * merge the two.
- *
otherwise, add the recessive child as a new child on the dominant root node.
- *
- *
- *
- */
- private static void mergeIntoXpp3Dom(Xpp3Dom dominant, Xpp3Dom recessive, Boolean childMergeOverride) {
- // TODO: share this as some sort of assembler, implement a walk interface?
- if (recessive == null) {
- return;
- }
- dominant.dom = dominant.dom.merge(recessive.dom, childMergeOverride);
- }
-
- /**
- * Merge two DOMs, with one having dominance in the case of collision.
- *
- * @see #CHILDREN_COMBINATION_MODE_ATTRIBUTE
- * @see #SELF_COMBINATION_MODE_ATTRIBUTE
- * @param dominant The dominant DOM into which the recessive value/attributes/children will be merged
- * @param recessive The recessive DOM, which will be merged into the dominant DOM
- * @param childMergeOverride Overrides attribute flags to force merging or appending of child elements into the
- * dominant DOM
- * @return merged DOM
- */
- public static Xpp3Dom mergeXpp3Dom(Xpp3Dom dominant, Xpp3Dom recessive, Boolean childMergeOverride) {
- if (dominant != null) {
- mergeIntoXpp3Dom(dominant, recessive, childMergeOverride);
- return dominant;
- }
- return recessive;
- }
-
- /**
- * Merge two DOMs, with one having dominance in the case of collision. Merge mechanisms (vs. override for nodes, or
- * vs. append for children) is determined by attributes of the dominant root node.
- *
- * @see #CHILDREN_COMBINATION_MODE_ATTRIBUTE
- * @see #SELF_COMBINATION_MODE_ATTRIBUTE
- * @param dominant The dominant DOM into which the recessive value/attributes/children will be merged
- * @param recessive The recessive DOM, which will be merged into the dominant DOM
- * @return merged DOM
- */
- public static Xpp3Dom mergeXpp3Dom(Xpp3Dom dominant, Xpp3Dom recessive) {
- if (dominant != null) {
- mergeIntoXpp3Dom(dominant, recessive, null);
- return dominant;
- }
- return recessive;
- }
-
- // ----------------------------------------------------------------------
- // Standard object handling
- // ----------------------------------------------------------------------
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
-
- if (!(obj instanceof Xpp3Dom)) {
- return false;
- }
-
- Xpp3Dom dom = (Xpp3Dom) obj;
- return this.dom.equals(dom.dom);
- }
-
- @Override
- public int hashCode() {
- return dom.hashCode();
- }
-
- @Override
- public String toString() {
- return dom.toString();
- }
-
- public String toUnescapedString() {
- return ((Xpp3Dom) dom).toUnescapedString();
- }
-
- public static boolean isNotEmpty(String str) {
- return ((str != null) && (str.length() > 0));
- }
-
- public static boolean isEmpty(String str) {
- return ((str == null) || (str.trim().length() == 0));
- }
-
- private void update(XmlNode dom) {
- if (childrenTracking != null) {
- childrenTracking.replace(this.dom, dom);
- }
- this.dom = dom;
- }
-
- private boolean replace(Object prevChild, Object newChild) {
- List children = new ArrayList<>(dom.getChildren());
- children.replaceAll(d -> d == prevChild ? (XmlNode) newChild : d);
- update(new XmlNodeImpl(dom.getName(), dom.getValue(), dom.getAttributes(), children, dom.getInputLocation()));
- return true;
- }
-
- public void setChildrenTracking(ChildrenTracking childrenTracking) {
- this.childrenTracking = childrenTracking;
- }
-
- @FunctionalInterface
- public interface ChildrenTracking {
- boolean replace(Object oldDelegate, Object newDelegate);
- }
-}
diff --git a/maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomBuilder.java b/maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomBuilder.java
deleted file mode 100644
index 8bd06991ff74..000000000000
--- a/maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomBuilder.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.codehaus.plexus.util.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-
-import org.apache.maven.internal.xml.XmlNodeBuilder;
-import org.codehaus.plexus.util.xml.pull.XmlPullParser;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-/**
- * @version $Id$
- */
-public class Xpp3DomBuilder {
- private static final boolean DEFAULT_TRIM = true;
-
- public static Xpp3Dom build(Reader reader) throws XmlPullParserException, IOException {
- return build(reader, null);
- }
-
- /**
- * @since 3.2.0
- */
- public static Xpp3Dom build(Reader reader, InputLocationBuilder locationBuilder)
- throws XmlPullParserException, IOException {
- return build(reader, DEFAULT_TRIM, locationBuilder);
- }
-
- public static Xpp3Dom build(InputStream is, String encoding) throws XmlPullParserException, IOException {
- return build(is, encoding, DEFAULT_TRIM);
- }
-
- public static Xpp3Dom build(InputStream is, String encoding, boolean trim)
- throws XmlPullParserException, IOException {
- try (InputStream closeMe = is) {
- return new Xpp3Dom(XmlNodeBuilder.build(is, encoding, trim));
- }
- }
-
- public static Xpp3Dom build(Reader reader, boolean trim) throws XmlPullParserException, IOException {
- return build(reader, trim, null);
- }
-
- /**
- * @since 3.2.0
- */
- public static Xpp3Dom build(Reader reader, boolean trim, InputLocationBuilder locationBuilder)
- throws XmlPullParserException, IOException {
- try (Reader closeMe = reader) {
- return new Xpp3Dom(XmlNodeBuilder.build(
- reader, trim, locationBuilder != null ? locationBuilder::toInputLocation : null));
- }
- }
-
- public static Xpp3Dom build(XmlPullParser parser) throws XmlPullParserException, IOException {
- return build(parser, DEFAULT_TRIM);
- }
-
- public static Xpp3Dom build(XmlPullParser parser, boolean trim) throws XmlPullParserException, IOException {
- return build(parser, trim, null);
- }
-
- /**
- * @since 3.2.0
- */
- public static Xpp3Dom build(XmlPullParser parser, boolean trim, InputLocationBuilder locationBuilder)
- throws XmlPullParserException, IOException {
- return new Xpp3Dom(
- XmlNodeBuilder.build(parser, trim, locationBuilder != null ? locationBuilder::toInputLocation : null));
- }
-
- /**
- * Input location builder interface, to be implemented to choose how to store data.
- *
- * @since 3.2.0
- */
- public interface InputLocationBuilder {
- Object toInputLocation(XmlPullParser parser);
- }
-}
diff --git a/maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/package-info.java b/maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/package-info.java
deleted file mode 100644
index 6cd95b0cb85e..000000000000
--- a/maven-xml-impl/src/main/java/org/codehaus/plexus/util/xml/package-info.java
+++ /dev/null
@@ -1,10 +0,0 @@
-// CHECKSTYLE_OFF: RegexpHeader
-/**
- * Contains modified versions of the
- * {@link org.codehaus.plexus.util.xml.Xpp3Dom} and
- * {@link org.codehaus.plexus.util.xml.Xpp3DomBuilder}
- * classes.
- * The modified {@link org.codehaus.plexus.util.xml.Xpp3Dom} wraps
- * an immutable {@link org.apache.maven.api.xml.XmlNode} instance.
- */
-package org.codehaus.plexus.util.xml;
diff --git a/plexus-utils/pom.xml b/plexus-utils/pom.xml
deleted file mode 100644
index 58a218f4e6af..000000000000
--- a/plexus-utils/pom.xml
+++ /dev/null
@@ -1,166 +0,0 @@
-
-
-
- 4.0.0
-
- org.apache.maven
- maven
- 4.0.0-alpha-6-SNAPSHOT
-
-
- org.apache.maven
- plexus-utils
- 4.0.0-alpha-6-SNAPSHOT
- Apache Maven Plexus-Utils
- Apache Maven repackaging of Plexus Utils with immutable Dom interface and its replacement implementation.
-
-
-
- org.codehaus.plexus
- plexus-utils
- ${plexusUtilsVersionEmbedded}
-
-
- org.apache.maven
- maven-xml-impl
- ${project.version}
- provided
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 3.1.1
-
-
- unpack-sources
-
- unpack
-
- generate-sources
-
-
-
- org.codehaus.plexus
- plexus-utils
- ${plexusUtilsVersionEmbedded}
- sources
- jar
- false
- ${project.build.directory}/generated-sources/plexus-utils
- **/*.java
- org/codehaus/plexus/util/xml/Xpp3Dom.java,
- org/codehaus/plexus/util/xml/Xpp3DomBuilder.java
-
-
-
-
-
- unpack-classes
-
- unpack
-
- process-classes
-
-
-
- org.codehaus.plexus
- plexus-utils
- ${plexusUtilsVersionEmbedded}
- jar
- false
- ${project.build.directory}/classes
- **/*.class,**/*.xml
- org/codehaus/plexus/util/xml/Xpp3Dom.class,
- org/codehaus/plexus/util/xml/Xpp3DomBuilder.class
-
-
- org.apache.maven
- maven-api-xml
- ${project.version}
- jar
- **/*
- ${project.build.directory}/classes
-
-
- org.apache.maven
- maven-xml-impl
- ${project.version}
- jar
- **/*
- ${project.build.directory}/classes
-
-
- **/*.java
- false
- true
-
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
- 3.3.0
-
-
- add-source
-
- add-source
-
- generate-sources
-
-
- target/generated-sources/plexus-utils
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.10.1
-
-
- compile
-
- true
-
-
-
-
-
- org.codehaus.mojo
- animal-sniffer-maven-plugin
-
-
- check-java-compat
- none
-
-
-
-
-
-
-
diff --git a/plexus-utils/site/markdown/index.md.vm b/plexus-utils/site/markdown/index.md.vm
deleted file mode 100644
index 709303d81b72..000000000000
--- a/plexus-utils/site/markdown/index.md.vm
+++ /dev/null
@@ -1,26 +0,0 @@
-
-Apache Maven Plexus Utils
-=========================
-
-This module is a repackaging of the `org.codehaus.plexus:plexus-utils` jar, which contains a few modified classes to allow a seamless transition between the Maven 3.x and 4.x APIs.
-
-The Maven 4.x API is based on immutable data objects. The Maven model contains a few classes that contain some open xml data for configuration (`Plugin`, `PluginExecution`, `ReportPlugin` and `ReportSet`). So the v3 API which was using the `org.codehaus.plexus.utils.xml.Xpp3Dom` class now wraps the `org.apache.maven.api.Dom` interface node. This is completely transparent for existing plugins, but the correct (new) classes have to be used.
-
-Given the new implementation of `org.codehaus.plexus.utils.xml.Xpp3Dom` now relies on `org.apache.maven.api.Dom`, the modifications can't be made inside the `plexus-utils` project, because Maven itself depends on it.
-
-This is drop-in replacement for `plexus-utils` ${plexusUtilsVersionEmbedded}.
diff --git a/plexus-utils/site/site.xml b/plexus-utils/site/site.xml
deleted file mode 100644
index d1c3532d82ab..000000000000
--- a/plexus-utils/site/site.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
- ${project.scm.url}
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index b20f91e2193b..0368f902a8d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,7 +108,6 @@ under the License.
maven-model-transformapimaven-xml-impl
- plexus-utilsmaven-coremaven-settingsmaven-settings-builder
@@ -157,8 +156,8 @@ under the License.
4.11.02.1.01.26
- 4.0.0-alpha-6-SNAPSHOT
- 3.5.1
+ 4.0.0
+ 4.0.05.1.030.1-jre1.0.1
@@ -205,10 +204,15 @@ under the License.
- org.apache.maven
+ org.codehaus.plexusplexus-utils${plexusUtilsVersion}
+
+ org.codehaus.plexus
+ plexus-xml
+ ${plexusXmlVersion}
+ com.google.injectguice