You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2025/08/29 13:58:40 UTC
(maven) branch maven-4.0.x updated: Fix XMLReader#getURL and enable the unit test (#11069) (#11078)
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch maven-4.0.x
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/maven-4.0.x by this push:
new fcb8f3597e Fix XMLReader#getURL and enable the unit test (#11069) (#11078)
fcb8f3597e is described below
commit fcb8f3597eaf31c45860c9895eb85af80abb3f11
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Aug 29 15:58:34 2025 +0200
Fix XMLReader#getURL and enable the unit test (#11069) (#11078)
(cherry picked from commit f169cf762bf22f090cd722c706ca901b25db8d99)
---
.../org/apache/maven/api/services/xml/XmlReaderRequest.java | 2 +-
.../org/apache/maven/impl/DefaultPluginXmlFactoryTest.java | 12 +++---------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java
index d6fc50e911..41733eb08b 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/xml/XmlReaderRequest.java
@@ -208,7 +208,7 @@ public Path getRootDirectory() {
@Override
public URL getURL() {
- return null;
+ return url;
}
@Override
diff --git a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
index 37e320cb32..4031fb9186 100644
--- a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
+++ b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultPluginXmlFactoryTest.java
@@ -37,7 +37,6 @@
import org.apache.maven.api.services.xml.XmlWriterRequest;
import org.apache.maven.impl.model.DefaultModelProcessor;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.io.TempDir;
import static java.util.UUID.randomUUID;
@@ -45,11 +44,10 @@
import static org.assertj.core.api.AssertionsForClassTypes.assertThatExceptionOfType;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.condition.OS.WINDOWS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-class DefaultPluginXmlFactoryReadWriteTest {
+class DefaultPluginXmlFactoryTest {
private static final String NAME = "sample-plugin-" + randomUUID();
private static final String SAMPLE_PLUGIN_XML =
@@ -252,15 +250,11 @@ void locateExistingPomWithFilePathShouldReturnSameFileIfRegularFile() throws IOE
}
@Test
- @DisabledOnOs(
- value = WINDOWS,
- disabledReason = "windows related issue https://github.com/apache/maven/pull/2312#issuecomment-2876291814")
void readFromUrlParsesPluginDescriptorCorrectly() throws Exception {
Path xmlFile = tempDir.resolve("plugin.xml");
Files.write(xmlFile, SAMPLE_PLUGIN_XML.getBytes());
- PluginDescriptor descriptor = defaultPluginXmlFactory.read(XmlReaderRequest.builder()
- .inputStream(xmlFile.toUri().toURL().openStream())
- .build());
+ PluginDescriptor descriptor = defaultPluginXmlFactory.read(
+ XmlReaderRequest.builder().url(xmlFile.toUri().toURL()).build());
assertThat(descriptor.getName()).isEqualTo(NAME);
assertThat(descriptor.getGroupId()).isEqualTo("org.example");
assertThat(descriptor.getArtifactId()).isEqualTo("sample-plugin");