diff options
author | Greg Wilkins | 2015-08-20 23:03:26 +0000 |
---|---|---|
committer | Greg Wilkins | 2015-08-20 23:03:26 +0000 |
commit | aca2aa56adf8319523e81d96b31a71eb1f30da14 (patch) | |
tree | cca60d47933daefe5df8986c1d3870a64f6955ee /jetty-start/src | |
parent | bfeb7f56a60d5efc4b9b7a2be39c0b75f1991a03 (diff) | |
download | org.eclipse.jetty.project-aca2aa56adf8319523e81d96b31a71eb1f30da14.tar.gz org.eclipse.jetty.project-aca2aa56adf8319523e81d96b31a71eb1f30da14.tar.xz org.eclipse.jetty.project-aca2aa56adf8319523e81d96b31a71eb1f30da14.zip |
475483 - Starting Jetty with [exec] should use properties file.
Added --exec-properties to allow the name of the properties file to be set
and for it not to be deleted on exit.
Diffstat (limited to 'jetty-start/src')
-rw-r--r-- | jetty-start/src/main/java/org/eclipse/jetty/start/StartArgs.java | 23 | ||||
-rw-r--r-- | jetty-start/src/main/resources/org/eclipse/jetty/start/usage.txt | 7 |
2 files changed, 26 insertions, 4 deletions
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 07415353af..db758d2c18 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 1c368eb4ab..8a6d10ad2b 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=<filename> + 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: ------------------------ |