Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support maven version 4.0.0-beta-5 for integration tests #101

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

import static io.takari.maven.testing.executor.MavenInstallationUtils.SYSPROP_MAVEN_HOME;
import static io.takari.maven.testing.executor.MavenInstallationUtils.SYSPROP_MAVEN_MAIN_CLASS;

import java.io.BufferedInputStream;
import java.io.BufferedWriter;
Expand Down Expand Up @@ -273,7 +274,9 @@ private static Embedded3xLauncher createFromMavenHome0(
Thread.currentThread().setContextClassLoader(bootLoader);
try {
ClassworldsConfiguration config = new ClassworldsConfiguration();
ConfigurationParser configParser = new ConfigurationParser(config, System.getProperties());
Properties properties = new Properties(System.getProperties());
properties.put(SYSPROP_MAVEN_MAIN_CLASS, "org.apache.maven.cli.MavenCli");
ConfigurationParser configParser = new ConfigurationParser(config, properties);
try (InputStream is = new BufferedInputStream(new FileInputStream(configFile))) {
configParser.parse(is);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* the License.
*/

import static io.takari.maven.testing.executor.MavenInstallationUtils.SYSPROP_MAVEN_MAIN_CLASS;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -118,6 +120,7 @@ public int run(
cli.addArgument("-Dclassworlds.conf=" + new File(mavenHome, "bin/m2.conf").getAbsolutePath());
cli.addArgument("-Dmaven.home=" + mavenHome.getAbsolutePath());
cli.addArgument("-Dmaven.multiModuleProjectDirectory=" + multiModuleProjectDirectory.getAbsolutePath());
cli.addArgument("-D" + SYSPROP_MAVEN_MAIN_CLASS + "=org.apache.maven.cling.MavenCling");

cli.addArguments(jvmArgs.toArray(new String[jvmArgs.size()]));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class MavenInstallationUtils {

public static final String SYSPROP_MAVEN_HOME = "maven.home";

public static final String SYSPROP_MAVEN_MAIN_CLASS = "maven.mainClass";

public static final String SYSPROP_CLASSWORLDSCONF = "classworlds.conf";

public static String getMavenVersion(Class<?> clazz) throws IOException {
Expand Down Expand Up @@ -104,6 +106,7 @@ public void addLoadURL(URL url) {}
VersionConfigHandler configHandler = new VersionConfigHandler();
Properties properties = new Properties(System.getProperties());
properties.setProperty(SYSPROP_MAVEN_HOME, mavenHome.getCanonicalPath());
properties.setProperty(SYSPROP_MAVEN_MAIN_CLASS, SYSPROP_MAVEN_MAIN_CLASS);
ConfigurationParser configParser = new ConfigurationParser(configHandler, properties);
try (InputStream is = new BufferedInputStream(new FileInputStream(classworldsConf))) {
configParser.parse(is);
Expand Down