Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

Commit

Permalink
Ensure we're setting PWD based on the project.baseDir in wildfly-swar…
Browse files Browse the repository at this point in the history
…m:start
  • Loading branch information
bobmcwhirter committed Dec 2, 2015
1 parent 825cd1d commit f97e990
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions plugin/src/main/java/org/wildfly/swarm/plugin/maven/StartMojo.java
Expand Up @@ -135,7 +135,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

protected SwarmProcess executeUberJar() throws MojoFailureException {
getLog().info( "Starting -swarm.jar" );
getLog().info("Starting -swarm.jar");

String finalName = this.project.getBuild().getFinalName();

Expand All @@ -153,6 +153,7 @@ protected SwarmProcess executeUberJar() throws MojoFailureException {
.withDebug(debugPort)
.withProperties(this.properties)
.withEnvironment(this.environment)
.withWorkingDirectory(this.project.getBasedir().toPath())
.withStdoutFile(this.stdoutFile != null ? this.stdoutFile.toPath() : null)
.withStderrFile(this.stderrFile != null ? this.stderrFile.toPath() : null)
.withExecutableJar(uberJar)
Expand All @@ -176,29 +177,30 @@ protected SwarmProcess executeUberJar() throws MojoFailureException {
}

protected SwarmProcess executeWar() throws MojoFailureException {
getLog().info( "Starting .war" );
getLog().info("Starting .war");

SwarmExecutor executor = new SwarmExecutor();
executor.withDebug(debugPort);
executor.withDefaultSystemProperties();
executor.withClassPathEntries(dependencies(false));
SwarmExecutor executor = new SwarmExecutor()
.withDebug(debugPort)
.withDefaultSystemProperties()
.withClassPathEntries(dependencies(false));

try {

String finalName = this.project.getBuild().getFinalName();
if (!finalName.endsWith(".war")) {
finalName = finalName + ".war";
}
executor.withProperty("wildfly.swarm.app.path", Paths.get(this.projectBuildDir, finalName).toString());
executor.withProperties(this.properties);
executor.withProperty("wildfly.swarm.context.path", this.contextPath);
executor.withDefaultMainClass();
executor.withProperty("wildfly.swarm.app.path", Paths.get(this.projectBuildDir, finalName).toString())
.withProperties(this.properties)
.withProperty("wildfly.swarm.context.path", this.contextPath)
.withEnvironment(this.environment)
.withWorkingDirectory(this.project.getBasedir().toPath())
.withDefaultMainClass();

executor.withEnvironment(this.environment);

if(stdoutFile != null)
if (stdoutFile != null)
executor.withStdoutFile(this.stdoutFile.toPath());
if(stderrFile != null)
if (stderrFile != null)
executor.withStderrFile(this.stderrFile.toPath());


Expand All @@ -221,28 +223,29 @@ protected SwarmProcess executeWar() throws MojoFailureException {
}

protected SwarmProcess executeJar() throws MojoFailureException {
getLog().info( "Starting .jar" );
getLog().info("Starting .jar");

SwarmExecutor executor = new SwarmExecutor();
executor.withDefaultSystemProperties();
executor.withDebug(debugPort);
SwarmExecutor executor = new SwarmExecutor()
.withDefaultSystemProperties()
.withDebug(debugPort);

try {
executor.withClassPathEntries(dependencies(true));
executor.withProperties(this.properties);
executor.withProperty("wildfly.swarm.context.path", this.contextPath);
executor.withClassPathEntries(dependencies(true))
.withProperties(this.properties)
.withProperty("wildfly.swarm.context.path", this.contextPath)
.withEnvironment(this.environment)
.withWorkingDirectory(this.project.getBasedir().toPath());

if (this.mainClass != null) {
executor.withMainClass(this.mainClass);
} else {
executor.withDefaultMainClass();
}

executor.withEnvironment(this.environment);

if(stdoutFile != null)
if (stdoutFile != null)
executor.withStdoutFile(this.stdoutFile.toPath());
if(stderrFile != null)
if (stderrFile != null)
executor.withStderrFile(this.stderrFile.toPath());

SwarmProcess process = executor.execute();
Expand Down

0 comments on commit f97e990

Please sign in to comment.