475483 - Starting Jetty with [exec] should use properties file.

Now using a properties file in case of [exec], and moved the
properties file inside the $jetty.base directory.
This commit is contained in:
Simone Bordet 2015-08-20 15:04:04 +02:00
parent d44ba7e24a
commit 837a36e3ec
1 changed files with 18 additions and 17 deletions

View File

@ -18,15 +18,14 @@
package org.eclipse.jetty.start;
import static org.eclipse.jetty.start.UsageException.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@ -43,6 +42,8 @@ import org.eclipse.jetty.start.config.ConfigSource;
import org.eclipse.jetty.start.config.ConfigSources;
import org.eclipse.jetty.start.config.DirConfigSource;
import static org.eclipse.jetty.start.UsageException.ERR_BAD_ARG;
/**
* The Arguments required to start Jetty.
*/
@ -581,20 +582,20 @@ public class StartArgs
ensureSystemPropertySet("STOP.WAIT");
// pass properties as args or as a file
if (dryRun || isExec())
if (dryRun)
{
for (Prop p : properties)
cmd.addRawArg(CommandLineBuilder.quote(p.key) + "=" + CommandLineBuilder.quote(p.value));
}
else if (properties.size() > 0)
{
File prop_file = File.createTempFile("start",".properties");
prop_file.deleteOnExit();
try (FileOutputStream out = new FileOutputStream(prop_file))
Path prop_path = Files.createTempFile(Paths.get(baseHome.getBase()), "start_", ".properties");
prop_path.toFile().deleteOnExit();
try (OutputStream out = Files.newOutputStream(prop_path))
{
properties.store(out,"start.jar properties");
}
cmd.addRawArg(prop_file.getAbsolutePath());
cmd.addRawArg(prop_path.toAbsolutePath().toString());
}
for (Path xml : xmls)