AWS CodePipeline 将 Spring Boot 应用程序部署到源根级别的 Elastic BeansTalk 没有 .jar 文件

发布于 2025-01-10 12:02:58 字数 1965 浏览 0 评论 0原文

我通过 3 个步骤为 SpringBoot Java 应用程序构建了一个简单的 CodePipeline:

Source: get the source from GitHub 
Build: a jar file 
Deploy: to an AWS Elastic Beanstalk instance

我在日志中遇到了此错误

执行命令 [app-deploy] 时发生错误 - [CheckProcfileForJavaApplication]。停止运行该命令。错误: 源的根级别没有 Procfile 和 .jar 文件 捆绑

我的构建规范:

version: 0.2

#env:
  #variables:
     # key: "value"
     # key: "value"
  #parameter-store:
     # key: "value"
     # key: "value"
  #secrets-manager:
     # key: secret-id:json-key:version-stage:version-id
     # key: secret-id:json-key:version-stage:version-id
  #exported-variables:
     # - variable
     # - variable
  #git-credential-helper: yes
#batch:
  #fast-fail: true
  #build-list:
  #build-matrix:
  #build-graph:
phases:
  install:
    runtime-versions:
      java: corretto11
    #If you use the Ubuntu standard image 2.0 or later, you must specify runtime-versions.
    #If you specify runtime-versions and use an image other than Ubuntu standard image 2.0, the build fails.
    #runtime-versions:
      # name: version
      # name: version
    #commands:
      # - command
      # - command
  #pre_build:
    #commands:
      # - command
      # - command
  build:
    commands:
      - mvn install
      # - command
      # - command
  #post_build:
    #commands:
      # - command
      # - command
#reports:
  #report-name-or-arn:
    #files:
      # - location
      # - location
    #base-directory: location
    #discard-paths: yes
    #file-format: JunitXml | CucumberJson
artifacts:
  files:
    - target/sbk-0.0.2.jar
    # - location
    # - location
  #name: $(date +%Y-%m-%d)
  #discard-paths: yes
  #base-directory: location
#cache:
  #paths:
    # - paths

在此处输入图像描述

当我手动上传到 EBS 时工作正常,但当使用管道上传时,它不起作用。

提前致谢

I built a simple CodePipeline for a SpringBoot Java application with 3 steps:

Source: get the source from GitHub 
Build: a jar file 
Deploy: to an AWS Elastic Beanstalk instance

I had this error in logs

An error occurred during execution of command [app-deploy] -
[CheckProcfileForJavaApplication]. Stop running the command. Error:
there is no Procfile and no .jar file at root level of your source
bundle

My Buildspec:

version: 0.2

#env:
  #variables:
     # key: "value"
     # key: "value"
  #parameter-store:
     # key: "value"
     # key: "value"
  #secrets-manager:
     # key: secret-id:json-key:version-stage:version-id
     # key: secret-id:json-key:version-stage:version-id
  #exported-variables:
     # - variable
     # - variable
  #git-credential-helper: yes
#batch:
  #fast-fail: true
  #build-list:
  #build-matrix:
  #build-graph:
phases:
  install:
    runtime-versions:
      java: corretto11
    #If you use the Ubuntu standard image 2.0 or later, you must specify runtime-versions.
    #If you specify runtime-versions and use an image other than Ubuntu standard image 2.0, the build fails.
    #runtime-versions:
      # name: version
      # name: version
    #commands:
      # - command
      # - command
  #pre_build:
    #commands:
      # - command
      # - command
  build:
    commands:
      - mvn install
      # - command
      # - command
  #post_build:
    #commands:
      # - command
      # - command
#reports:
  #report-name-or-arn:
    #files:
      # - location
      # - location
    #base-directory: location
    #discard-paths: yes
    #file-format: JunitXml | CucumberJson
artifacts:
  files:
    - target/sbk-0.0.2.jar
    # - location
    # - location
  #name: $(date +%Y-%m-%d)
  #discard-paths: yes
  #base-directory: location
#cache:
  #paths:
    # - paths

enter image description here

it'is work fine when I upload manualy to EBS but when do it withe the pipeline , its doesnt work.

thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

红衣飘飘貌似仙 2025-01-17 12:02:58

我找到了解决方案

AWS BS在pckaging文件夹中找不到jar,他找到了target/xx.jar
我所做的是将 jar 移动到主文件夹
这个命令

  - mv target/*.jar app.jar

充满了构建规范

 version: 0.2
    
    phases:
      install:
        runtime-versions:emphasized text
          java: corretto11
        commands:
          - echo install
      pre_build:
        commands:
          - echo pre_build
      build:
        commands:
          - mvn package
          - echo build
      post_build:
        commands:
          - echo post_build
          - mv target/*.jar app.jar
    
    artifacts:
      files:
        - app.jar

I found the solution

AWS BS dont found the jar in the pckaging folder, he found target/xx.jar
What i did is i move the jar to main folder
with this commande

  - mv target/*.jar app.jar

full of buildspec

 version: 0.2
    
    phases:
      install:
        runtime-versions:emphasized text
          java: corretto11
        commands:
          - echo install
      pre_build:
        commands:
          - echo pre_build
      build:
        commands:
          - mvn package
          - echo build
      post_build:
        commands:
          - echo post_build
          - mv target/*.jar app.jar
    
    artifacts:
      files:
        - app.jar
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文