简体   繁体   中英

Error when deploying maven project to Google app engine

I was trying to deploy a maven project to Google App Engine, but whenever i use the command mvn appengine:deploy in cmd i get this error

    [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

Here's my 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>

Does anyone know how to solve this problem? I've been looking for the solution for days but it seems hopeless.

your project is a spring boot project so try using spring-maven plugin to generate the jar

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

I had the same problem, and tried it a different way.

Since appengine:deploy didn't seem to copy my app.yaml but instead created its own, I tried to use gcloud commands directly on the target/appengine-staging after pasting my yaml file.

Then I run gcloud app deploy and it worked thanks to this line I added in app.yaml :

health_check: enable_health_check: False

Starting from version 1.3.0 the appengine plugin even doesn't detect my app.yaml in the first place. However it's set on the root folder. I suppose it requires it in a different place/folder but I don't know which one.

Pretty late to the party, but make sure you have specified the packaging as 'war'. That solved my issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM