将maven项目部署到Google应用程序引擎时出错

时间:2017-04-21 15:06:19

标签: java maven google-app-engine

我尝试将maven项目部署到Google App Engine,但每当我在cmd中使用命令mvn appengine:deploy时,我都会收到此错误

    [INFO] GCLOUD:
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 08:43 min
    [INFO] Finished at: 2017-04-21T21:43:13+07:00
    [INFO] Final Memory: 22M/287M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-
    plugin:1.2.1:deploy (default-cli) on project cc_w10: Execution default-cli 
    of goal com.google.cloud.tools:appengine-maven-plugin:1.2.1:deploy failed: 
    Non zero exit: 1 -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

这是我的pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.cc_w10.sample</groupId>
    <artifactId>cc_w10</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.1.RELEASE</version>
    </parent>  

    <properties>
        <java.version>1.8</java.version>

        <INSTANCE_CONNECTION_NAME></INSTANCE_CONNECTION_NAME>
        <user>user1</user>
        <password>1234</password>
        <database>sqldemo</database>
        <sqlURL>jdbc:mysql://google/sqldemo?cloudSqlInstance=cc-week-five:us-central1:root&amp;socketFactory=com.google.cloud.sql.mysql.SocketFactory&amp;user=root&amp;password=1234&amp;useSSL=false</sqlURL>

    </properties>

      <dependencies>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>    

        <dependency>
            <groupId>com.google.cloud.sql</groupId>
            <artifactId>mysql-socket-factory-connector-j-6</artifactId>
            <version>1.0.2</version>
        </dependency>

        <dependency>                       
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>6.0.5</version>
        </dependency>

      </dependencies>

    <build>
        <finalName>cc_w10</finalName>    
        <plugins>
            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>appengine-maven-plugin</artifactId>
                <version>1.2.1</version>
            </plugin>
            <plugin>
                <groupId>com.google.appengine</groupId>
                <artifactId>appengine-maven-plugin</artifactId>
                <version>1.9.50</version>
            </plugin>   

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.3.7.v20160115</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>      
        </plugins>    
    </build>
</project>

有谁知道如何解决这个问题?我一直在寻找解决方案,但似乎没有希望。

3 个答案:

答案 0 :(得分:1)

你的项目是一个春季启动项目,所以尝试使用spring-maven插件来生成jar

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>

答案 1 :(得分:0)

我遇到了同样的问题,并以不同的方式尝试了。

由于appengine:deploy似乎没有复制我的app.yaml,而是创建了自己的{I},我尝试在粘贴我的yaml文件后直接在目标/ appengine-staging上使用gcloud命令。 / p>

然后我运行gcloud app deploy,感谢我在app.yaml添加的这一行:

health_check: enable_health_check: False

从版本1.3.0开始,appengine插件甚至不会首先检测到我的app.yaml。但是它设置在根文件夹上。我想它需要在不同的地方/文件夹,但我不知道哪一个。

答案 2 :(得分:0)

参加聚会的时间很晚,但是请确保将包装指定为“战争”。那解决了我的问题。