Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the google appengine maven plugin to deploy a Jax-RS war

I'm trying to make a simple base project to deploy a service I make using Jax-RS librarys to my Google app engine cloud space. The problem is that I don't know how to configure the plugin properly to not keep looking to a webapp directory under the target folder. The structure of the Jax-rs project puts the web.xml and all other WEB-INF files under the resources directory instead of a webapp directory. Is there a way to configure the maven plugin to deploy my already built and zipped up war file?

This is the error I see

[INFO] Updating Google App Engine Application Unable to find the webapp directory C:\dev\gameTrunk\server\target\HOMMTG-server-1.0 usage: AppCfg [options] [] []

Action must be one of: help: Print help for a specific action.
download_app: Download a previously uploaded app version.
request_logs: Write request logs in Apache common log format.
rollback: Rollback an in-progress update. start: Start the specified server version.

and it goes on with all the appengine plugin targets...

This s my pom

<plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <version>2.5.1</version>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <archiveClasses>true</archiveClasses>
                <webResources>
                    <!-- in order to interpolate version from pom into appengine-web.xml -->
                    <resource>
                        <directory>${basedir}/src/main/resources/WEB-INF</directory>
                        <filtering>true</filtering>
                        <targetPath>WEB-INF</targetPath>
                    </resource>
                </webResources>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-maven-plugin</artifactId>
            <version>${appengine.target.version}</version>
        </plugin>
    </plugins>

Thats just the plugins part but its almost exactly the same as the guestbook example project except for the path for the WEB-INF directory

like image 247
Flostation Avatar asked Oct 21 '22 19:10

Flostation


2 Answers

Currently there is no way to configure the appengine-maven-plugin to use a different directory for the war contents. It would be best though to probably create a multimodule build where one submodule just used the maven-ant-plugin to assemble the war directory and then run the plugin on that instead. I don't think we want to make that configurable in the plugin, since it doesn't really align with the maven-war-plugin, and configuring that would make it difficult to setup your project to use the maven-war-plugin seamlessly in the future.

The configuration you currently have for the war-plugin in your pom isn't necessary unless you want interpolation of the version number into the appengine-web.xml. I'm happy to help with setting up your pom so that the official Google App Engine Maven plugin works correctly for you.

like image 161
MattStep Avatar answered Oct 27 '22 11:10

MattStep


(The instructions below apply to maven-gae-plugin, not appengine-maven-plugin. Have I told you how much Google sucks in Open Source today?)

I think you must add in your maven-gae-plugin a property called appDir pointing to your webapp directory, like this:

   <plugin>
        <groupId>net.kindleit</groupId>
        <artifactId>maven-gae-plugin</artifactId>
        <configuration>
          <appDir>PATH-TO-YOUR-BUILT-EXPLODED-WAR-PATH</appDir>
        </configuration>
   </plugin>

However, I must stress that changing the path in Maven produces undesirable results (you're mixing source and object code, your .ignore files will get messed up, and other weird things)

Note you STILL NEED your unpacked war somewhere. One way to achieve that is to create another .war project and use dependencies-unpack into it. See http://maven.apache.org/plugins/maven-dependency-plugin/unpack-dependencies-mojo.html

(reference: https://github.com/maven-gae-plugin/maven-gae-plugin/blob/master/maven-gae-plugin/src/main/java/net/kindleit/gae/EngineGoalBase.java)

(just in case, there is a JAX-RS based project for GAE I've wrote a while ago, and its open. See https://github.com/ipeirotis/ReadabilityMetrics/ for an overview)

like image 39
aldrinleal Avatar answered Oct 27 '22 10:10

aldrinleal