GoogleCloudPlatform / appengine-maven-plugin

Automatically exported from code.google.com/p/appengine-maven-plugin
Apache License 2.0
19 stars 21 forks source link

Add configurable application target dir in devserver goal #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In the current version of plugin appDir is readed from :
String appDir = project.getBuild().getDirectory() + "/" + 
project.getBuild().getFinalName(); (DevAppServerRunner class). Configurable 
property, for example app.dir, will be very helpfull in multimodule maven 
applications.

Example structure:

my-app-dir
|
 --service-module
|
 --web-module

In above structure I can't, in the base app directory (my-app-dir), recompile 
all submodules and execute devserver (mvn clean package appengine:devserver), I 
have to execute mvn clean package on base dir and than change current dir on 
web-module and finally execute mvn appengine:devserver

Original issue reported on code.google.com by Rebiz...@gmail.com on 21 Mar 2014 at 11:12

GoogleCodeExporter commented 9 years ago
I suggest the following patch:

diff --git 
a/src/main/java/com/google/appengine/devappserver/DevAppServerAsyncStart.java 
b/src/main/java/com/google/appengine/devappserver/DevAppServerAsyncStart.java
index 83595b0..b9df073 100644
--- 
a/src/main/java/com/google/appengine/devappserver/DevAppServerAsyncStart.java
+++ 
b/src/main/java/com/google/appengine/devappserver/DevAppServerAsyncStart.java
@@ -18,6 +18,12 @@ import java.util.ArrayList;
  * @threadSafe false
  */
 public class DevAppServerAsyncStart extends AbstractDevAppServerMojo {
+    /**
+     * The location of the appengine application to run.
+     *
+     * @parameter expression="${appengine.appDir}"
+     */
+    protected String appDir;

   @Override
   public void execute() throws MojoExecutionException, MojoFailureException {
@@ -25,7 +31,8 @@ public class DevAppServerAsyncStart extends 
AbstractDevAppServerMojo {
     getLog().info("Google App Engine Java SDK - Starting the Development Server");
     getLog().info("");

-    String appDir = project.getBuild().getDirectory() + "/" + 
project.getBuild().getFinalName();
+    if(appDir == null)
+      appDir = project.getBuild().getDirectory() + "/" + 
project.getBuild().getFinalName();

     File appDirFile = new File(appDir);

diff --git 
a/src/main/java/com/google/appengine/devappserver/DevAppServerRunner.java 
b/src/main/java/com/google/appengine/devappserver/DevAppServerRunner.java
index 66a9169..9a49600 100644
--- a/src/main/java/com/google/appengine/devappserver/DevAppServerRunner.java
+++ b/src/main/java/com/google/appengine/devappserver/DevAppServerRunner.java
@@ -18,14 +18,21 @@ import java.util.ArrayList;
  * @threadSafe false
  */
 public class DevAppServerRunner extends AbstractDevAppServerMojo {
-
+    /**
+     * The location of the appengine application to run.
+     *
+     * @parameter expression="${appengine.appDir}"
+     */
+    protected String appDir;
+
   @Override
   public void execute() throws MojoExecutionException, MojoFailureException {
     getLog().info("");
     getLog().info("Google App Engine Java SDK - Running Development Server");
     getLog().info("");

-    String appDir = project.getBuild().getDirectory() + "/" + 
project.getBuild().getFinalName();
+    if(appDir == null)
+      appDir = project.getBuild().getDirectory() + "/" + 
project.getBuild().getFinalName();

     File appDirFile = new File(appDir);

Original comment by dajudge...@gmail.com on 28 Mar 2014 at 12:32

GoogleCodeExporter commented 9 years ago
yes, this patch should be ok

Original comment by Rebiz...@gmail.com on 3 Apr 2014 at 1:59

GoogleCodeExporter commented 9 years ago
Fix will be in 1.9.7
For now, you can 
$ git clone https://code.google.com/p/appengine-maven-plugin/
$ cd appengine-maven-plugin
$ mvn install

and use the version 1.9.7-SNAPSHOT in the plugin version as a workaround until 
1.9.7 is pushed

Original comment by l...@google.com on 14 Jun 2014 at 5:24