在Code Build使用CDK打包Java Lambda失败

0

【以下的问题经过翻译处理】 我正在按照这篇博客(https://aws.amazon.com/blogs/opensource/packaging-and-deploying-aws-lambda-functions-written-in-java-with-aws-cloud-development-kit/)的步骤使用CDK创建Java Lambda函数。但是当我推送了更改后,在CodeBuild中失败,出现以下错误。在我的本地机器上,"cdk synth" 命令工作正常。

Bundling asset TestStack/test/LambdaStack/LambdaFunction/Code/Stage...
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project test: An exception occured while executing the Java class. Failed to bundle asset TestStack/test/LambdaStack/LambdaFunction/Code/Stage, bundle output is located at /codebuild/output/src940121800/src/cdk.out/asset.593cf75a4cb232e162ae4760eddc8336106322f580119285c2b8f0df0c517874-error: Error: docker exited with status 125
profile picture
EXPERT
asked 6 months ago45 views
1 Answer
0

【以下的回答经过翻译处理】 我在CodeBuild的环境变量中启用了特权选项,并在CodePipeline构建中添加了"dockerEnabledForSynth(true)"。然后它按预期运行。

我认为mvn构建脚本尝试下载Maven库,但失败了导致了错误。一旦我启用了特权选项,它就正常工作了。我认为这与Docker无关,但不能确定。

profile picture
EXPERT
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions