gpt4 book ai didi

aws-codepipeline - 如何在 AWS CodeBuild Standard Linux 2.0 (Ubuntu 18.0) 中安装 Maven

转载 作者:行者123 更新时间:2023-12-05 06:21:20 24 4
gpt4 key购买 nike

我正在尝试使用 AWS Codebuild 构建我的项目。下面是我的 buildspce.yml。我的源代码在 s3 存储桶中,文件类型是 zip。

 version: 0.2
phases:
install:
runtime-versions:
java: openjdk8
commands:
- apt-get update -y
- apt-get install -y maven
pre_build:
commands:
- java -version
- mvn -version
# - command
build:
commands:
- echo Entered the build phase...
- echo Build started on `date`
- mvn package -Dmaven.test.failure.ignore=true
# - command
finally:
- echo This always runs even if the install command fails
#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:
# - location
# - location
#name: $(date +%Y-%m-%d)
#discard-paths: yes
#base-directory: location
#cache:
#paths:
# - paths

我得到 COMMAND_EXECUTION_ERROR:执行命令时出错:apt-get install -y maven。原因:INSTALL 阶段退出状态 100 错误。即使我从安装阶段删除了 maven 并且只添加了 mvn package 然后也得到了 exit code 1 的错误。

最佳答案

Maven 已经安装在 java: openjdk8 中,可以在此处确认 [1]。

快速测试:

version: 0.2

phases:
install:
runtime-versions:
java: openjdk8

build:
commands:
- mvn -v

构建日志:

[Container] 2020/01/23 10:51:01 Running command mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T19:00:29Z)
Maven home: /opt/maven
Java version: 1.8.0_222, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.14.152-98.182.amzn1.x86_64", arch: "amd64", family: "unix"

[1] https://github.com/aws/aws-codebuild-docker-images/blob/master/ubuntu/standard/2.0/Dockerfile

关于aws-codepipeline - 如何在 AWS CodeBuild Standard Linux 2.0 (Ubuntu 18.0) 中安装 Maven,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59858544/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com