}
}
@Override
public void run(RestxShell shell) throws Exception {
AppSettings appSettings = shell.getFactory()
.getComponent(AppSettings.class);
Optional<String> pack = Optional.absent();
if (appClassName == null) {
pack = Apps.with(appSettings)
.guessAppBasePackage(shell.currentLocation());
if (!pack.isPresent()) {
shell.printIn("can't find base app package, src/main/java should contain a AppServer.java source file somewhere",
RestxShell.AnsiCodes.ANSI_RED);
shell.println("");
shell.println("alternatively you can provide the class to run with `app generate-start-script <class.to.Run>`");
return;
}
appClassName = pack.get() + ".AppServer";
} else {
pack = Optional.of(appClassName.substring(0, appClassName.lastIndexOf('.')));
}
String command = "java" +
" -cp \"" + appSettings.targetClasses() + ":" + appSettings.targetDependency() + "/*\"" +
" -Drestx.app.package=" + pack.get() +
" -Drestx.mode=prod"
;
File startSh = shell.currentLocation().resolve("start.sh").toFile();