Deploy stage failed: FileMagic v0.7.1 error

0

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

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

1 and 2 steps successfully pass while Deploy step fails. The only error I see in eb-activity.log:

01_configure_application.sh] : Activity execution failed, because: Executing: /usr/bin/unzip -o -d /var/app/staging /opt/elasticbeanstalk/deploy/appsource/source_bundle
  FileMagic v0.7.1: compiled magic version [5.21] does not match with shared library magic version [5.37]
  Archive:  /opt/elasticbeanstalk/deploy/appsource/source_bundle
    inflating: /var/app/staging/microservices/my-service/target/my-service.jar  
  Unable to launch application as the source bundle does not contain either a file named application.jar or a Procfile.
  Unable to launch application as the source bundle does not contain either a file named application.jar or a Procfile. (ElasticBeanstalk::ExternalInvocationError)
caused by: Executing: /usr/bin/unzip -o -d /var/app/staging /opt/elasticbeanstalk/deploy/appsource/source_bundle
  FileMagic v0.7.1: compiled magic version [5.21] does not match with shared library magic version [5.37]
  Archive:  /opt/elasticbeanstalk/deploy/appsource/source_bundle
    inflating: /var/app/staging/microservices/my-service/target/my-service.jar  
  Unable to launch application as the source bundle does not contain either a file named application.jar or a Procfile.
  Unable to launch application as the source bundle does not contain either a file named application.jar or a Procfile. (Executor::NonZeroExitStatus)

My Buildspec:

build:
  commands:
      - mvn -P ci --settings settings.xml install -DskipTests
artifacts:
  files:
     - microservices/my-service/target/my-service.jar

If I deploy this jar directly to AWS Elastic Beanstalk using AWS Web Interface, it works perfectly.

Please, help me. I'm ready to share any other config on demand.

Edited by: siden on Mar 24, 2020 7:14 PM

Edited by: siden on Mar 24, 2020 7:22 PM

Edited by: siden on Mar 24, 2020 7:24 PM

siden
已提问 4 年前217 查看次数
1 回答
0

The problem was in artifact's sub-folders, it's impossible to use an artifact location as in my Buildspec:

artifacts:
  files:
     - microservices/my-service/target/my-service.jar

the only correct way is folder/myapp.jar, for example:

artifacts:
  files:
     - target/my-service.jar

so you should specify outputDirectory in your maven config if it is different.

siden
已回答 4 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则