0

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

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.