我通过3个步骤为SpringBoot Java应用程序构建了一个简单的CodePipeline:
1和2步骤成功通过,而Deploy步骤失败。我在Elastic Beanstalk日志中看到的唯一错误是:
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)
我的Buildspec:
build:
commands:
- mvn -P ci --settings settings.xml install -DskipTests
artifacts:
files:
- microservices/my-service/target/my-service.jar
如果我使用AWS Web Interface将这个jar直接部署到AWS Elastic Beanstalk,它会完美地工作。
请帮我。我准备按需共享任何其他配置。
问题出在工件的子文件夹中,无法像我的Buildspec中那样使用工件位置:
artifacts:
files:
- microservices/my-service/target/my-service.jar
唯一正确的方法是folder/myapp.jar
,例如:
artifacts:
files:
- target/my-service.jar
所以你应该outputDirectory
在你的Maven配置中指定是否不同
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句