使用谷歌appengine maven插件来部署Jax-RS战争

Flo*_*ion 5 google-app-engine jax-rs web-inf web-deployment maven

我正在尝试创建一个简单的基础项目,将我使用Jax-RS库进行的服务部署到我的Google应用引擎云空间.问题是我不知道如何正确配置插件以不继续查看目标文件夹下的webapp目录.Jax-rs项目的结构将web.xml和所有其他WEB-INF文件放在resources目录下而不是webapp目录下.有没有办法配置maven插件来部署我已经构建和压缩的war文件?

这是我看到的错误

[INFO]更新Google App Engine应用程序无法找到webapp目录C:\ dev\gameTrunk\server\target\HOMMTG-server-1.0用法:AppCfg [options] [] []

操作必须是以下之一:help:打印特定操作的帮助.
download_app:下载以前上传的应用版本.
request_logs:以Apache通用日志格式写入请求日志.
rollback:回滚正在进行的更新.start:启动指定的服务器版本.

它继续所有的appengine插件目标...

这是我的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>
Run Code Online (Sandbox Code Playgroud)

这只是插件部分,但它与guestbook示例项目几乎完全相同,除了WEB-INF目录的路径

ald*_*eal 1

(下面的说明适用于maven-gae-plugin,而不是 appengine-maven-plugin 。我有没有告诉过你今天 Google 在开源方面有多糟糕?)

我认为你必须在你的 maven-gae-plugin 中添加一个名为appDir指向你的 webapp 目录的属性,如下所示:

   <plugin>
        <groupId>net.kindleit</groupId>
        <artifactId>maven-gae-plugin</artifactId>
        <configuration>
          <appDir>PATH-TO-YOUR-BUILT-EXPLODED-WAR-PATH</appDir>
        </configuration>
   </plugin>
Run Code Online (Sandbox Code Playgroud)

但是,我必须强调,更改 Maven 中的路径会产生不良结果(您混合了源代码和目标代码,您的 .ignore 文件会变得混乱,以及其他奇怪的事情)

请注意,您仍然需要在某个地方展开战争。实现此目的的一种方法是创建另一个 .war 项目并在其中使用依赖项解包。请参阅http://maven.apache.org/plugins/maven-dependency-plugin/unpack-dependency-mojo.html

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

(以防万一,我不久前为 GAE 编写了一个基于 JAX-RS 的项目,并且它已开放。有关概述,请参阅https://github.com/ipeirotis/ReadabilityMetrics/ )