files = dirsAndFiles.get(false);
if (files != null && !files.isEmpty())
@@ -554,7 +553,7 @@ public class StartArgs
else
{
cmd.addRawArg("--class-path");
- cmd.addRawArg(environment.getClasspath().toString());
+ cmd.addRawArg(coreEnvironment.getClasspath().toString());
}
}
@@ -565,18 +564,20 @@ public class StartArgs
cmd.addRawArg(getMainClassname());
}
- // pass properties as args or as a file
+ // do properties and xmls
if (parts.contains("args"))
{
if (dryRun && execProperties == null)
{
- for (Prop p : environment.getProperties())
+ // pass properties as args
+ for (Prop p : coreEnvironment.getProperties())
{
cmd.addRawArg(CommandLineBuilder.quote(p.key) + "=" + CommandLineBuilder.quote(p.value));
}
}
- else if (environment.getProperties().size() > 0)
+ else if (coreEnvironment.getProperties().size() > 0)
{
+ // pass properties as a temp property file
Path propPath;
if (execProperties == null)
{
@@ -588,22 +589,37 @@ public class StartArgs
try (OutputStream out = Files.newOutputStream(propPath))
{
- environment.getProperties().store(out, "start.jar properties");
+ coreEnvironment.getProperties().store(out, "start.jar properties");
}
cmd.addRawArg(propPath.toAbsolutePath().toString());
}
- for (Path xml : environment.getXmlFiles())
+ for (Path xml : coreEnvironment.getXmlFiles())
{
cmd.addRawArg(xml.toAbsolutePath().toString());
}
- for (Path propertyFile : environment.getPropertyFiles())
+ for (Path propertyFile : coreEnvironment.getPropertyFiles())
{
cmd.addRawArg(propertyFile.toAbsolutePath().toString());
}
}
+ if (parts.contains("envs"))
+ {
+ for (Environment environment : getEnvironments())
+ {
+ if (environment == coreEnvironment)
+ continue;
+
+ Path envPath = Files.createTempFile("env_%s_".formatted(environment.getName()), ".xml");
+ environment.generateXml(coreEnvironment, envPath);
+ if (!isDryRun())
+ envPath.toFile().deleteOnExit();
+ cmd.addRawArg(envPath.toAbsolutePath().toString());
+ }
+ }
+
return cmd;
}
diff --git a/jetty-core/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-core/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
index c392c6b8ee5..93811564034 100644
--- a/jetty-core/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
+++ b/jetty-core/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt
@@ -71,6 +71,7 @@ Report Commands:
o "path" - the JVM class-path and/or the JPMS module-path
o "main" - the main class to run
o "args" - the arguments passed to the main class
+ o "envs" - the generated XML files to create the environments
Configure Commands:
-------------------
diff --git a/jetty-core/jetty-xml/src/main/java/org/eclipse/jetty/xml/EnvironmentBuilder.java b/jetty-core/jetty-xml/src/main/java/org/eclipse/jetty/xml/EnvironmentBuilder.java
index 0197944be0e..2be0bd91117 100644
--- a/jetty-core/jetty-xml/src/main/java/org/eclipse/jetty/xml/EnvironmentBuilder.java
+++ b/jetty-core/jetty-xml/src/main/java/org/eclipse/jetty/xml/EnvironmentBuilder.java
@@ -32,43 +32,6 @@ import org.eclipse.jetty.util.resource.Resource;
/**
* A Builder of {@link Environment}s intended to be used in XML
* files generated by start.jar
.
- *
*
*/
public class EnvironmentBuilder extends AbstractMap