in meecrowave-core/src/main/java/org/apache/meecrowave/runner/Cli.java [63:101]
public void run() {
final ParsedCommand parsedCommand = new ParsedCommand(args).invoke();
if (parsedCommand.isFailed()) {
return;
}
final Meecrowave.Builder builder = parsedCommand.getBuilder();
final CommandLine line = parsedCommand.getLine();
try (final Meecrowave meecrowave = new Meecrowave(builder)) {
synchronized (this) {
if (closed) {
return;
}
this.instance = meecrowave;
}
final String ctx = line.getOptionValue("context", "");
final String fixedCtx = !ctx.isEmpty() && !ctx.startsWith("/") ? '/' + ctx : ctx;
final String war = line.getOptionValue("webapp");
meecrowave.start();
if (war == null) {
meecrowave.deployClasspath(new Meecrowave.DeploymentMeta(
ctx,
ofNullable(line.getOptionValue("docbase")).map(File::new).orElseGet(() ->
Stream.of("base", "home")
.map(it -> System.getProperty("meecrowave." + it))
.filter(Objects::nonNull)
.map(it -> new File(it, "docBase"))
.filter(File::isDirectory)
.findFirst()
.orElse(null)),
null,
null));
} else {
meecrowave.deployWebapp(fixedCtx, new File(war));
}
doWait(meecrowave, line);
}
}