Skip to content

Commit caee992

Browse files
committed
[MPLUGINTESTING-95] Update parent pom to 43
Cleanup deprecated code. Update to Maven 3.9.9
1 parent b3dee7b commit caee992

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

maven-plugin-testing-harness/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ under the License.
3939
<dependency>
4040
<groupId>org.junit</groupId>
4141
<artifactId>junit-bom</artifactId>
42-
<version>5.10.2</version>
42+
<version>5.11.0</version>
4343
<type>pom</type>
4444
<scope>import</scope>
4545
</dependency>
@@ -116,7 +116,6 @@ under the License.
116116
<dependency>
117117
<groupId>org.codehaus.plexus</groupId>
118118
<artifactId>plexus-utils</artifactId>
119-
<version>3.5.1</version>
120119
</dependency>
121120
<dependency>
122121
<groupId>org.codehaus.plexus</groupId>

maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
7373
import org.codehaus.plexus.context.Context;
7474
import org.codehaus.plexus.util.InterpolationFilterReader;
75-
import org.codehaus.plexus.util.ReaderFactory;
7675
import org.codehaus.plexus.util.ReflectionUtils;
7776
import org.codehaus.plexus.util.StringUtils;
7877
import org.codehaus.plexus.util.xml.XmlStreamReader;
@@ -297,7 +296,7 @@ protected <T extends Mojo> T lookupEmptyMojo(String goal, String pluginPom) thro
297296
protected <T extends Mojo> T lookupMojo(String goal, File pom) throws Exception {
298297
File pluginPom = new File(getBasedir(), "pom.xml");
299298

300-
Xpp3Dom pluginPomDom = Xpp3DomBuilder.build(ReaderFactory.newXmlReader(pluginPom));
299+
Xpp3Dom pluginPomDom = Xpp3DomBuilder.build(new XmlStreamReader(pluginPom));
301300

302301
String artifactId = pluginPomDom.getChild("artifactId").getValue();
303302

@@ -321,7 +320,7 @@ protected <T extends Mojo> T lookupMojo(String goal, File pom) throws Exception
321320
protected <T extends Mojo> T lookupEmptyMojo(String goal, File pom) throws Exception {
322321
File pluginPom = new File(getBasedir(), "pom.xml");
323322

324-
Xpp3Dom pluginPomDom = Xpp3DomBuilder.build(ReaderFactory.newXmlReader(pluginPom));
323+
Xpp3Dom pluginPomDom = Xpp3DomBuilder.build(new XmlStreamReader(pluginPom));
325324

326325
String artifactId = pluginPomDom.getChild("artifactId").getValue();
327326

@@ -507,7 +506,7 @@ private void finalizeMojoConfiguration(MojoExecution mojoExecution) {
507506
*/
508507
protected PlexusConfiguration extractPluginConfiguration(String artifactId, File pom) throws Exception {
509508

510-
try (Reader reader = ReaderFactory.newXmlReader(pom)) {
509+
try (Reader reader = new XmlStreamReader(pom)) {
511510
Xpp3Dom pomDom = Xpp3DomBuilder.build(reader);
512511
return extractPluginConfiguration(artifactId, pomDom);
513512
}

maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/junit5/MojoExtension.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
7070
import org.codehaus.plexus.testing.PlexusExtension;
7171
import org.codehaus.plexus.util.InterpolationFilterReader;
72-
import org.codehaus.plexus.util.ReaderFactory;
7372
import org.codehaus.plexus.util.ReflectionUtils;
7473
import org.codehaus.plexus.util.xml.XmlStreamReader;
7574
import org.codehaus.plexus.util.xml.Xpp3Dom;
@@ -203,18 +202,18 @@ private Mojo lookupMojo(
203202
Xpp3Dom pomDom;
204203
if (pom.startsWith("file:")) {
205204
Path path = Paths.get(getBasedir()).resolve(pom.substring("file:".length()));
206-
pomDom = Xpp3DomBuilder.build(ReaderFactory.newXmlReader(path.toFile()));
205+
pomDom = Xpp3DomBuilder.build(new XmlStreamReader(path.toFile()));
207206
} else if (pom.startsWith("classpath:")) {
208207
URL url = holder.getResource(pom.substring("classpath:".length()));
209208
if (url == null) {
210209
throw new IllegalStateException("Unable to find pom on classpath: " + pom);
211210
}
212-
pomDom = Xpp3DomBuilder.build(ReaderFactory.newXmlReader(url.openStream()));
211+
pomDom = Xpp3DomBuilder.build(new XmlStreamReader(url.openStream()));
213212
} else if (pom.contains("<project>")) {
214213
pomDom = Xpp3DomBuilder.build(new StringReader(pom));
215214
} else {
216215
Path path = Paths.get(getBasedir()).resolve(pom);
217-
pomDom = Xpp3DomBuilder.build(ReaderFactory.newXmlReader(path.toFile()));
216+
pomDom = Xpp3DomBuilder.build(new XmlStreamReader(path.toFile()));
218217
}
219218
Xpp3Dom pluginConfiguration = extractPluginConfiguration(coord[1], pomDom);
220219
if (!mojoParameters.isEmpty()) {
@@ -238,7 +237,7 @@ protected String[] mojoCoordinates(String goal) throws Exception {
238237
return goal.split(":");
239238
} else {
240239
Path pluginPom = Paths.get(getBasedir(), "pom.xml");
241-
Xpp3Dom pluginPomDom = Xpp3DomBuilder.build(ReaderFactory.newXmlReader(pluginPom.toFile()));
240+
Xpp3Dom pluginPomDom = Xpp3DomBuilder.build(new XmlStreamReader(pluginPom.toFile()));
242241
String artifactId = pluginPomDom.getChild("artifactId").getValue();
243242
String groupId = resolveFromRootThenParent(pluginPomDom, "groupId");
244243
String version = resolveFromRootThenParent(pluginPomDom, "version");
@@ -263,11 +262,10 @@ protected Mojo lookupMojo(String[] coord, Xpp3Dom pluginConfiguration, PluginDes
263262
}
264263
if (pluginConfiguration != null) {
265264
MavenSession session = getContainer().lookup(MavenSession.class);
266-
MavenProject project;
267265
try {
268-
project = getContainer().lookup(MavenProject.class);
269-
} catch (ComponentLookupException e) {
270-
project = null;
266+
getContainer().lookup(MavenProject.class);
267+
} catch (ComponentLookupException ignore) {
268+
// nothing
271269
}
272270
MojoExecution mojoExecution;
273271
try {

maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
5959
import org.apache.maven.project.MavenProject;
6060
import org.codehaus.plexus.PlexusTestCase;
61-
import org.codehaus.plexus.util.ReaderFactory;
61+
import org.codehaus.plexus.util.xml.XmlStreamReader;
6262
import org.codehaus.plexus.util.xml.Xpp3Dom;
6363
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
6464

@@ -186,7 +186,7 @@ protected void readModel(File pomFile) {
186186
pomFile = new File(getBasedir(), pomFile.getPath());
187187
}
188188
try {
189-
setModel(new MavenXpp3Reader().read(ReaderFactory.newXmlReader(pomFile)));
189+
setModel(new MavenXpp3Reader().read(new XmlStreamReader(pomFile)));
190190
} catch (IOException e) {
191191
throw new RuntimeException("Failed to read POM file: " + pomFile, e);
192192
} catch (XmlPullParserException e) {

pom.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ under the License.
2323
<parent>
2424
<groupId>org.apache.maven</groupId>
2525
<artifactId>maven-parent</artifactId>
26-
<version>42</version>
26+
<version>43</version>
2727
<relativePath />
2828
</parent>
2929

@@ -64,8 +64,7 @@ under the License.
6464
</distributionManagement>
6565

6666
<properties>
67-
<surefire.version>3.2.5</surefire.version>
68-
<mavenVersion>3.9.6</mavenVersion>
67+
<mavenVersion>3.9.9</mavenVersion>
6968
<maven.site.path>plugin-testing-archives/LATEST</maven.site.path>
7069
<javaVersion>8</javaVersion>
7170
<project.build.outputTimestamp>2023-11-07T21:58:12Z</project.build.outputTimestamp>

0 commit comments

Comments
 (0)