我正在尝试使用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: Error while executing command: apt-get install -y maven. Reason: exit status 100错误。即使我从安装阶段删除了maven,并且只添加了mvn package,exit code 1也会出现错误。
发布于 2020-01-23 10:55:51
Maven已经安装在java: openjdk8中,这一点可以在这里确认。
做了一个快速测试:
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"https://stackoverflow.com/questions/59858544
复制相似问题