简体   繁体   English

将 Spring 引导项目部署到 Google App-Engine 失败并出现 Maven

[英]Deployment of Spring Boot Project to Google App-Engine fails with Maven

I keep trying to deploy my Spring-Boot application to Google appengine.我一直在尝试将我的 Spring-Boot 应用程序部署到 Google appengine。 I am using the SDK and the maven plugin.我正在使用 SDK 和 maven 插件。

The Spring-Boot-Application is running perfectly on my localhost, but when i try to deploy it with mvn package appengine:deploy I get the following error message: Spring-Boot-Application 在我的本地主机上完美运行,但是当我尝试使用mvn package appengine:deploy部署它时,我收到以下错误消息:

BUILD FAILURE
Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:2.2.0:deploy (default-cli) on project TestProject: App Engine application deployment failed: com.google.cloud.tools.appengine.operations.cloudsdk.process.ProcessHandlerException: com.google.cloud.tools.appengine.AppEngineException: Non zero exit: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:2.2.0:deploy (default-cli) on project TestProject: App Engine application deployment failed
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    ...

Interesting is the fact, that a similar error occurs when trying to deploy to Microsoft Azure.有趣的是,在尝试部署到 Microsoft Azure 时会发生类似的错误。

I followed the official tutorial from google ( https://codelabs.developers.google.com/codelabs/cloud-app-engine-springboot/ ) and tried a few other tutorials as well.我按照谷歌的官方教程( https://codelabs.developers.google.com/codelabs/cloud-app-engine-springboot/ )并尝试了其他一些教程。 Nothing seems to fix the issue for me.似乎没有什么可以解决我的问题。

My pom.xml file:我的 pom.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>

<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/xsd/maven-4.0.0.xsd">  
  <modelVersion>4.0.0</modelVersion>  
  <groupId>de.myname</groupId>  
  <artifactId>TestProject</artifactId>  
  <version>1.0-SNAPSHOT</version>  
  <parent> 
    <groupId>org.springframework.boot</groupId>  
    <artifactId>spring-boot-starter-parent</artifactId>  
    <version>2.1.9.RELEASE</version> 
  </parent>  

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


  <properties> 
    <java.version>1.8</java.version> 
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>  


  <build> 
    <plugins> 

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

      <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>appengine-maven-plugin</artifactId>
        <version>2.2.0</version>
        <configuration>
          <version>1</version>
          <projectId>GCLOUD_CONFIG</projectId>
        </configuration>
      </plugin>
    </plugins> 
  </build> 
</project>

My app.yaml looks like the following:我的 app.yaml 如下所示:

runtime: java
env: flex

handlers:
  - url: /.*
    script: this field is required, but ignored

The issue you presented really depends on the size and scope of the Spring Boot application you are working on.您提出的问题实际上取决于您正在处理的 Spring 引导应用程序的大小和 scope。 I have however followed the deployment steps that were provided from your link.但是,我已按照您的链接提供的部署步骤进行操作。 Here are my findings:以下是我的发现:

You are getting MojoExecutionException according to your error output.根据您的错误 output,您将获得 MojoExecutionException。 This error is not generated by Maven itself, but due to a plugin.此错误不是由 Maven 本身产生的,而是由插件引起的。 Plugins trigger this error message to signal a problem in your configuration of information retrieved from the pom.xml file.插件会触发此错误消息,以表明您从 pom.xml 文件中检索到的信息的配置存在问题。 You may want to look into that, by updating all plugins, if possible.如果可能的话,您可能想通过更新所有插件来调查这一点。 https://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException https://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

You would need to make sure you configure your pom.xml file correctly.您需要确保正确配置 pom.xml 文件。 Perhaps you are missing certain dependencies that your project needs in order to run.也许您缺少项目运行所需的某些依赖项。 The version of Java you are deploying your application should match the one listed in your pom.xml file.您正在部署应用程序的 Java 的版本应该与您的 pom.xml 文件中列出的版本相匹配。 Unable to Build using MAVEN with ERROR - Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 无法使用 MAVEN 构建错误 - 无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:31。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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