mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-10-17 16:07:25 +00:00
This commit is contained in:
@@ -132,9 +132,11 @@ public class DefaultClient implements Client {
|
|||||||
} else {
|
} else {
|
||||||
dir = parameters.userDir();
|
dir = parameters.userDir();
|
||||||
}
|
}
|
||||||
|
Path multiModuleProjectDirectory = parameters.multiModuleProjectDirectory(dir);
|
||||||
System.setProperty(
|
System.setProperty(
|
||||||
Environment.MAVEN_MULTIMODULE_PROJECT_DIRECTORY.getProperty(),
|
Environment.MAVEN_MULTIMODULE_PROJECT_DIRECTORY.getProperty(), multiModuleProjectDirectory.toString());
|
||||||
parameters.multiModuleProjectDirectory(dir).toString());
|
Environment.MAVEN_MULTIMODULE_PROJECT_DIRECTORY.addCommandLineOption(
|
||||||
|
args, multiModuleProjectDirectory.toString());
|
||||||
|
|
||||||
// .mvn/jvm.config
|
// .mvn/jvm.config
|
||||||
if (Files.isRegularFile(parameters.jvmConfigPath())) {
|
if (Files.isRegularFile(parameters.jvmConfigPath())) {
|
||||||
|
@@ -1443,7 +1443,6 @@ public class DaemonMavenCli implements DaemonCli {
|
|||||||
|
|
||||||
static void populateProperties(CliRequest cliRequest, Properties systemProperties, Properties userProperties)
|
static void populateProperties(CliRequest cliRequest, Properties systemProperties, Properties userProperties)
|
||||||
throws InterpolationException {
|
throws InterpolationException {
|
||||||
addEnvVars(systemProperties);
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Options that are set on the command line become system properties
|
// Options that are set on the command line become system properties
|
||||||
@@ -1462,6 +1461,7 @@ public class DaemonMavenCli implements DaemonCli {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addEnvVars(systemProperties);
|
||||||
SystemProperties.addSystemProperties(systemProperties);
|
SystemProperties.addSystemProperties(systemProperties);
|
||||||
|
|
||||||
StringSearchInterpolator interpolator = createInterpolator(cliRequest, cliProperties, systemProperties);
|
StringSearchInterpolator interpolator = createInterpolator(cliRequest, cliProperties, systemProperties);
|
||||||
@@ -1471,6 +1471,14 @@ public class DaemonMavenCli implements DaemonCli {
|
|||||||
userProperties.setProperty(name, value);
|
userProperties.setProperty(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
systemProperties.putAll(userProperties);
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// I'm leaving the setting of system properties here as not to break
|
||||||
|
// the SystemPropertyProfileActivator. This won't harm embedding. jvz.
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
userProperties.forEach((k, v) -> System.setProperty((String) k, (String) v));
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Properties containing info about the currently running version of Maven
|
// Properties containing info about the currently running version of Maven
|
||||||
// These override any corresponding properties set on the command line
|
// These override any corresponding properties set on the command line
|
||||||
|
@@ -56,4 +56,38 @@ class MavenConfNativeIT {
|
|||||||
assertTrue(
|
assertTrue(
|
||||||
o.getMessages().stream().anyMatch(m -> m.toString().contains(conf)), "Output should contain " + conf);
|
o.getMessages().stream().anyMatch(m -> m.toString().contains(conf)), "Output should contain " + conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void interpolation() throws IOException, InterruptedException {
|
||||||
|
final TestClientOutput o = new TestClientOutput();
|
||||||
|
client.execute(
|
||||||
|
o,
|
||||||
|
"org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate",
|
||||||
|
"-D",
|
||||||
|
"expression=something",
|
||||||
|
"-q",
|
||||||
|
"-DforceStdout",
|
||||||
|
"--raw-streams")
|
||||||
|
.assertSuccess();
|
||||||
|
String conf = parameters.multiModuleProjectDirectory().toString();
|
||||||
|
assertTrue(
|
||||||
|
o.getMessages().stream().anyMatch(m -> m.toString().contains(conf)), "Output should contain " + conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void multiModuleProjectDirectory() throws IOException, InterruptedException {
|
||||||
|
final TestClientOutput o = new TestClientOutput();
|
||||||
|
client.execute(
|
||||||
|
o,
|
||||||
|
"org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate",
|
||||||
|
"-D",
|
||||||
|
"expression=maven.multiModuleProjectDirectory",
|
||||||
|
"-q",
|
||||||
|
"-DforceStdout",
|
||||||
|
"--raw-streams")
|
||||||
|
.assertSuccess();
|
||||||
|
String conf = parameters.multiModuleProjectDirectory().toString();
|
||||||
|
assertTrue(
|
||||||
|
o.getMessages().stream().anyMatch(m -> m.toString().contains(conf)), "Output should contain " + conf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,18 @@
|
|||||||
*/
|
*/
|
||||||
package org.mvndaemon.mvnd.it;
|
package org.mvndaemon.mvnd.it;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
import org.mvndaemon.mvnd.junit.MvndTest;
|
import org.mvndaemon.mvnd.junit.MvndTest;
|
||||||
|
|
||||||
@MvndTest(projectDir = "src/test/projects/maven-conf")
|
@MvndTest(projectDir = "src/test/projects/maven-conf")
|
||||||
class MavenConfTest extends MavenConfNativeIT {}
|
class MavenConfTest extends MavenConfNativeIT {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@Override
|
||||||
|
void multiModuleProjectDirectory() throws IOException, InterruptedException {
|
||||||
|
// empty test as multiModuleProjectDirectory is set by the client
|
||||||
|
// and can not be really tested
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user