2017-04-21 118 views
1

我试图部署Maven项目,以谷歌的App Engine,但每当我在cmd中使用命令mvn appengine:deploy我得到这个错误时错误部署Maven项目到谷歌应用程序引擎

[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> 

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

回答

1

你的项目是弹簧启动的项目,所以请尝试使用弹簧Maven插件生成JAR

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

它仍然不起作用。 –

+0

你试过用apppengine插件吗? –

+0

我在我的pom.xml中有appengine插件,这是否意味着它会自动启用,还是必须手动启用它?如果是这样,我该怎么做? –

0

我有同样的问题,并尝试了不同的方式。

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

然后我跑gcloud app deploy,并以这条线我app.yaml增加工作的感谢:

health_check: enable_health_check: False 

从1.3.0版本开始的AppEngine上的插件,即使没有检测到我app.yaml摆在首位。但是它被设置在根文件夹中。我想它需要在不同的地方/文件夹,但我不知道哪一个。

+0

我更新了应用程序,并再次遇到同样的问题......我想这只是随机超时。我真的很惊讶,这些基本功能不起作用。我对Google的期望更高...... –

+0

在我使用gcloud应用程序部署它之后,它在project.appspot.com网站中显示“404未找到”,尽管在部署过程中没有发生错误。你知道为什么以及如何正确部署它吗?此外,当我添加health_check:enable_health_检查:False到app.yaml它说:“错误:(gcloud.app.deploy)解析文件时发生错误:[D:\ WorkSpace \ cc_w10 \ app.yaml] 无法将值'enable_health_check'分配给'health_check'属性:“。对不起,我的混乱的评论。 –

+0

我解决了我通过将这个添加到yaml文件中的部署错误:资源: memory_gb:4.0 –

相关问题