Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring启动项目的buildspec.yml文件_Java_Spring_Amazon Web Services_Spring Boot_Amazon Elastic Beanstalk - Fatal编程技术网

Java Spring启动项目的buildspec.yml文件

Java Spring启动项目的buildspec.yml文件,java,spring,amazon-web-services,spring-boot,amazon-elastic-beanstalk,Java,Spring,Amazon Web Services,Spring Boot,Amazon Elastic Beanstalk,我有一个名为“BikeService”的Spring Boot项目。我正在使用pom.xml文件中的以下命令为该项目生成一个war文件 <packaging>war</packaging> 上传代码后,部署成功,环境状况正常,但在运行环境URL时,它会显示HTTP 404-找不到 version: 0.2 phases: install: runtime-versions: java: corretto8 pre_build: com

我有一个名为“BikeService”的Spring Boot项目。我正在使用pom.xml文件中的以下命令为该项目生成一个war文件

<packaging>war</packaging>
上传代码后,部署成功,环境状况正常,但在运行环境URL时,它会显示HTTP 404-找不到

version: 0.2
phases:
  install:
    runtime-versions:
      java: corretto8
  pre_build:
    commands:
    - echo In the pre_build phase...
  build:
    commands:
    - echo Build started on `date`
  post_build:
    commands:
    - echo Build completed on `date`
    - mvn package
    - mv target/bike-service-0.0.1-SNAPSHOT.war bike-service-0.0.1-SNAPSHOT.war
artifacts:
  files:
  - bike-service-0.0.1-SNAPSHOT.war
  - .ebextensions/**/*
我正在使用以下buildspec.yml文件:

version: 0.2
phases:
  install:
    runtime-versions:
      java: corretto11
  pre_build:
    commands:
    - echo In the pre_build phase...
  build:
    commands:
    - echo Build started on `date`
    - mvn install
  post_build:
    commands:
    - echo Build completed on `date`
artifacts:
  files:
  - target/bike-service-0.0.1-SNAPSHOT.war
  - scripts/*

经过大量的研究,这个问题得到了解决

问题在于buildspec.yml文件

我正在发布正确的buildspec.yml文件,以防将来有人搜索它

以下文件适用于带有war打包的Spring引导项目

version: 0.2
phases:
  install:
    runtime-versions:
      java: corretto8
  pre_build:
    commands:
    - echo In the pre_build phase...
  build:
    commands:
    - echo Build started on `date`
  post_build:
    commands:
    - echo Build completed on `date`
    - mvn package
    - mv target/bike-service-0.0.1-SNAPSHOT.war bike-service-0.0.1-SNAPSHOT.war
artifacts:
  files:
  - bike-service-0.0.1-SNAPSHOT.war
  - .ebextensions/**/*

当您从内部登录到您的EB实例并
curl
您的应用程序时,它是否在您想要的端口上按预期工作?