diff --git a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java index 07415353afa..db758d2c185 100644 --- a/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java +++ b/jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java @@ -179,6 +179,7 @@ public class StartArgs private boolean dryRun = false; private boolean exec = false; + private String exec_properties; private boolean approveAllLicenses = false; public StartArgs() @@ -582,15 +583,22 @@ public class StartArgs ensureSystemPropertySet("STOP.WAIT"); // pass properties as args or as a file - if (dryRun) + if (dryRun && exec_properties==null) { for (Prop p : properties) cmd.addRawArg(CommandLineBuilder.quote(p.key) + "=" + CommandLineBuilder.quote(p.value)); } else if (properties.size() > 0) { - Path prop_path = Files.createTempFile(Paths.get(baseHome.getBase()), "start_", ".properties"); - prop_path.toFile().deleteOnExit(); + Path prop_path; + if (exec_properties==null) + { + prop_path=Files.createTempFile(Paths.get(baseHome.getBase()), "start_", ".properties"); + prop_path.toFile().deleteOnExit(); + } + else + prop_path=new File(exec_properties).toPath(); + try (OutputStream out = Files.newOutputStream(prop_path)) { properties.store(out,"start.jar properties"); @@ -897,6 +905,15 @@ public class StartArgs exec = true; return; } + + // Assign a fixed name to the property file for exec + if (arg.startsWith("--exec-properties=")) + { + exec_properties=Props.getValue(arg); + if (!exec_properties.endsWith(".properties")) + throw new UsageException(ERR_BAD_ARG,"--exec-properties filename must have .properties suffix: %s",exec_properties); + return; + } // Enable forked execution of Jetty server if ("--approve-all-licenses".equals(arg)) diff --git a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt index 1c368eb4ab1..8a6d10ad2b7 100644 --- a/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt +++ b/jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt @@ -34,7 +34,12 @@ Command Line Options: a sub process. This can be used when start.ini contains -X or -D arguments, but creates an extra JVM instance. - + + --exec-properties= + Assign a fixed name to the file used to transfer + properties to the sub process. This allows the + generated properties file to be saved and reused. + Without this option, a temporary file is used. Debug and Start Logging: ------------------------