mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-21 19:35:08 +00:00
Switch to Maven 4.0.0-alpha-8 (#895)
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
*/
|
||||
package org.mvndaemon.mvnd.client;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -41,9 +43,8 @@ import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.maven.cli.internal.extension.io.CoreExtensionsStaxReader;
|
||||
import org.apache.maven.cli.internal.extension.model.CoreExtension;
|
||||
import org.apache.maven.cli.internal.extension.model.io.xpp3.CoreExtensionsXpp3Reader;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
import org.mvndaemon.mvnd.common.Environment;
|
||||
import org.mvndaemon.mvnd.common.InterpolationHelper;
|
||||
import org.mvndaemon.mvnd.common.Os;
|
||||
@@ -449,7 +450,7 @@ public class DaemonParameters {
|
||||
.map(e -> e.getGroupId() + ":" + e.getArtifactId() + ":" + e.getVersion())
|
||||
.collect(Collectors.toList());
|
||||
return String.join(";", extensions);
|
||||
} catch (IOException | XmlPullParserException e) {
|
||||
} catch (IOException | XMLStreamException e) {
|
||||
throw new RuntimeException("Unable to parse core extensions", e);
|
||||
}
|
||||
} else {
|
||||
@@ -470,7 +471,7 @@ public class DaemonParameters {
|
||||
}
|
||||
|
||||
private static List<CoreExtension> readCoreExtensionsDescriptor(Path multiModuleProjectDirectory)
|
||||
throws IOException, XmlPullParserException {
|
||||
throws IOException, XMLStreamException {
|
||||
if (multiModuleProjectDirectory == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -478,7 +479,7 @@ public class DaemonParameters {
|
||||
if (!Files.exists(extensionsFile)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
CoreExtensionsXpp3Reader parser = new CoreExtensionsXpp3Reader();
|
||||
CoreExtensionsStaxReader parser = new CoreExtensionsStaxReader();
|
||||
try (InputStream is = Files.newInputStream(extensionsFile)) {
|
||||
return parser.read(is).getExtensions();
|
||||
}
|
||||
|
@@ -287,10 +287,10 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
}
|
||||
topDirectory = getCanonicalPath(topDirectory);
|
||||
cliRequest.topDirectory = topDirectory;
|
||||
// We're very early in the process and we don't have the container set up yet,
|
||||
// We're very early in the process, and we don't have the container set up yet,
|
||||
// so we rely on the JDK services to eventually look up a custom RootLocator.
|
||||
// This is used to compute {@code session.rootDirectory} but all {@code project.rootDirectory}
|
||||
// properties will be compute through the RootLocator found in the container.
|
||||
// properties will be computed through the RootLocator found in the container.
|
||||
RootLocator rootLocator =
|
||||
ServiceLoader.load(RootLocator.class).iterator().next();
|
||||
Path rootDirectory = rootLocator.findRoot(topDirectory);
|
||||
@@ -495,6 +495,7 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
if (MessageUtils.isColorEnabled()) {
|
||||
MessageBuilder buff = MessageUtils.builder();
|
||||
buff.a("Message styles: ");
|
||||
buff.trace("trace").a(' ');
|
||||
buff.debug("debug").a(' ');
|
||||
buff.info("info").a(' ');
|
||||
buff.warning("warning").a(' ');
|
||||
@@ -571,10 +572,11 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
.filter(s -> s != null && !s.isEmpty())
|
||||
.map(s -> {
|
||||
String[] parts = s.split(":");
|
||||
CoreExtension ce = new CoreExtension();
|
||||
ce.setGroupId(parts[0]);
|
||||
ce.setArtifactId(parts[1]);
|
||||
ce.setVersion(parts[2]);
|
||||
CoreExtension ce = CoreExtension.newBuilder()
|
||||
.groupId(parts[0])
|
||||
.artifactId(parts[1])
|
||||
.version(parts[2])
|
||||
.build();
|
||||
return ce;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
@@ -623,11 +625,18 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
|
||||
container.setLoggerManager(plexusLoggerManager);
|
||||
|
||||
AbstractValueSource extensionSource = new AbstractValueSource(false) {
|
||||
@Override
|
||||
public Object getValue(String expression) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
for (CoreExtensionEntry extension : extensionsEntries) {
|
||||
container.discoverComponents(
|
||||
extension.getClassRealm(),
|
||||
new SessionScopeModule(container),
|
||||
new MojoExecutionScopeModule(container));
|
||||
new MojoExecutionScopeModule(container),
|
||||
new ExtensionConfigurationModule(extension, extensionSource));
|
||||
}
|
||||
return container;
|
||||
}
|
||||
@@ -1181,12 +1190,12 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
}
|
||||
|
||||
private String determineLocalRepositoryPath(final MavenExecutionRequest request) {
|
||||
String userDefinedLocalRepo = request.getUserProperties().getProperty(MavenCli.LOCAL_REPO_PROPERTY);
|
||||
String userDefinedLocalRepo = request.getUserProperties().getProperty(DaemonMavenCli.LOCAL_REPO_PROPERTY);
|
||||
if (userDefinedLocalRepo != null) {
|
||||
return userDefinedLocalRepo;
|
||||
}
|
||||
|
||||
return request.getSystemProperties().getProperty(MavenCli.LOCAL_REPO_PROPERTY);
|
||||
return request.getSystemProperties().getProperty(DaemonMavenCli.LOCAL_REPO_PROPERTY);
|
||||
}
|
||||
|
||||
private File determinePom(
|
||||
@@ -1199,22 +1208,16 @@ public class DaemonMavenCli implements DaemonCli {
|
||||
alternatePomFile = commandLine.getOptionValue(CLIManager.ALTERNATE_POM_FILE);
|
||||
}
|
||||
|
||||
File current = baseDirectory;
|
||||
if (alternatePomFile != null) {
|
||||
File pom = resolveFile(new File(alternatePomFile), workingDirectory);
|
||||
if (pom.isDirectory()) {
|
||||
pom = new File(pom, "pom.xml");
|
||||
}
|
||||
|
||||
return pom;
|
||||
} else if (modelProcessor != null) {
|
||||
File pom = modelProcessor.locatePom(baseDirectory);
|
||||
|
||||
if (pom.isFile()) {
|
||||
return pom;
|
||||
}
|
||||
current = resolveFile(new File(alternatePomFile), workingDirectory);
|
||||
}
|
||||
|
||||
return null;
|
||||
if (modelProcessor != null) {
|
||||
return modelProcessor.locateExistingPom(current);
|
||||
} else {
|
||||
return current.isFile() ? current : null;
|
||||
}
|
||||
}
|
||||
|
||||
// Visible for testing
|
||||
|
4
pom.xml
4
pom.xml
@@ -88,7 +88,7 @@
|
||||
<jansi.version>2.4.0</jansi.version>
|
||||
<jline.version>3.23.0</jline.version>
|
||||
<junit.jupiter.version>5.9.2</junit.jupiter.version>
|
||||
<maven.version>4.0.0-alpha-7</maven.version>
|
||||
<maven.version>4.0.0-alpha-8</maven.version>
|
||||
<maven3.version>3.9.5</maven3.version>
|
||||
<maven4.version>${maven.version}</maven4.version>
|
||||
<!-- Keep in sync with Maven -->
|
||||
@@ -113,7 +113,7 @@
|
||||
<maven-assembly-plugin.version>3.6.0</maven-assembly-plugin.version>
|
||||
<xstream.version>1.4.20</xstream.version>
|
||||
<plexus-interactivity-api.version>1.0</plexus-interactivity-api.version>
|
||||
<takari-smart-builder.version>0.6.3</takari-smart-builder.version>
|
||||
<takari-smart-builder.version>0.6.4</takari-smart-builder.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
Reference in New Issue
Block a user