diff --git a/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorPathTest.java b/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorPathTest.java index fae3aafca8..905efd9ce1 100644 --- a/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorPathTest.java +++ b/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorPathTest.java @@ -25,8 +25,8 @@ import java.nio.file.Paths; import org.apache.maven.configuration.internal.DefaultBeanConfigurator; +import org.apache.maven.internal.xml.XmlNodeBuilder; import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -53,7 +53,7 @@ public void tearDown() throws Exception { private Xpp3Dom toConfig(String xml) { try { - return Xpp3DomBuilder.build(new StringReader("" + xml + "")); + return new Xpp3Dom(XmlNodeBuilder.build(new StringReader("" + xml + ""))); } catch (XmlPullParserException | IOException e) { throw new IllegalArgumentException(e); } diff --git a/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorTest.java b/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorTest.java index 9c27076cc9..a33a6f342f 100644 --- a/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorTest.java +++ b/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorTest.java @@ -23,8 +23,8 @@ import java.io.StringReader; import org.apache.maven.configuration.internal.DefaultBeanConfigurator; +import org.apache.maven.internal.xml.XmlNodeBuilder; import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -51,7 +51,7 @@ public void tearDown() throws Exception { private Xpp3Dom toConfig(String xml) { try { - return Xpp3DomBuilder.build(new StringReader("" + xml + "")); + return new Xpp3Dom(XmlNodeBuilder.build(new StringReader("" + xml + ""))); } catch (XmlPullParserException | IOException e) { throw new IllegalArgumentException(e); } diff --git a/maven-embedder/src/main/java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java b/maven-embedder/src/main/java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java index 3150955d8f..709f0d0662 100644 --- a/maven-embedder/src/main/java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java +++ b/maven-embedder/src/main/java/org/eclipse/sisu/plexus/PlexusXmlBeanConverter.java @@ -40,7 +40,6 @@ import org.apache.maven.api.xml.XmlNode; import org.apache.maven.internal.xml.XmlNodeBuilder; import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.codehaus.plexus.util.xml.pull.MXParser; import org.codehaus.plexus.util.xml.pull.XmlPullParser; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; @@ -116,7 +115,7 @@ private Object parse(final MXParser parser, final TypeLiteral toType) throws return XmlNodeBuilder.build(parser); } if (Xpp3Dom.class.isAssignableFrom(rawType)) { - return parseXpp3Dom(parser); + return new Xpp3Dom(XmlNodeBuilder.build(parser)); } if (Properties.class.isAssignableFrom(rawType)) { return parseProperties(parser); @@ -133,16 +132,6 @@ private Object parse(final MXParser parser, final TypeLiteral toType) throws return parseBean(parser, toType, rawType); } - /** - * Parses an XML subtree and converts it to the {@link Xpp3Dom} type. - * - * @param parser The XML parser - * @return Converted Xpp3Dom instance - */ - private static Xpp3Dom parseXpp3Dom(final XmlPullParser parser) throws Exception { - return Xpp3DomBuilder.build(parser); - } - /** * Parses a sequence of XML elements and converts them to the appropriate {@link Properties} type. * diff --git a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadataGenerator.java b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadataGenerator.java index b3d68847ec..5886807640 100644 --- a/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadataGenerator.java +++ b/maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/PluginsMetadataGenerator.java @@ -18,7 +18,7 @@ */ package org.apache.maven.repository.internal; -import java.io.Reader; +import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collection; @@ -30,10 +30,9 @@ import java.util.jar.JarFile; import java.util.zip.ZipEntry; +import org.apache.maven.api.xml.XmlNode; +import org.apache.maven.internal.xml.XmlNodeBuilder; import org.apache.maven.repository.internal.PluginsMetadata.PluginInfo; -import org.codehaus.plexus.util.ReaderFactory; -import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.eclipse.aether.RepositorySystemSession; import org.eclipse.aether.artifact.Artifact; import org.eclipse.aether.deployment.DeployRequest; @@ -123,14 +122,13 @@ private PluginInfo extractPluginInfo(Artifact artifact) { ZipEntry pluginDescriptorEntry = artifactJar.getEntry(PLUGIN_DESCRIPTOR_LOCATION); if (pluginDescriptorEntry != null) { - try (Reader reader = - ReaderFactory.newXmlReader(artifactJar.getInputStream(pluginDescriptorEntry))) { + try (InputStream is = artifactJar.getInputStream(pluginDescriptorEntry)) { // Note: using DOM instead of use of // org.apache.maven.plugin.descriptor.PluginDescriptor // as it would pull in dependency on: // - maven-plugin-api (for model) // - Plexus Container (for model supporting classes and exceptions) - Xpp3Dom root = Xpp3DomBuilder.build(reader); + XmlNode root = XmlNodeBuilder.build(is, null); String groupId = root.getChild("groupId").getValue(); String artifactId = root.getChild("artifactId").getValue(); String goalPrefix = root.getChild("goalPrefix").getValue();