首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在AWS CodeBuild标准Linux2.0(Ubuntu18.0)中安装Maven

如何在AWS CodeBuild标准Linux2.0(Ubuntu18.0)中安装Maven
EN

Stack Overflow用户
提问于 2020-01-22 11:19:38
回答 1查看 1.7K关注 0票数 2

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

代码语言:javascript
复制
 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 packageexit code 1也会出现错误。

EN

回答 1

Stack Overflow用户

发布于 2020-01-23 10:55:51

Maven已经安装在java: openjdk8中,这一点可以在这里确认。

做了一个快速测试:

代码语言:javascript
复制
version: 0.2

phases:
  install:
    runtime-versions:
      java: openjdk8

  build:
    commands:
      - mvn -v

构建日志:

代码语言:javascript
复制
[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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59858544

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档