Updated on 2023-12-06 GMT+08:00

Using YAML to Configure a Maven Build

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
version: 2.0 # The value must be 2.0.
steps:
  BUILD:
    - maven:
          image: cloudbuild@maven3.5.3-jdk8-open # You can customize the image path. For details, see the following description.
          inputs:
            settings:
              public_repos:
                - https://mirrors.example.com/maven
            cache: true # Indicates whether to enable the cache.
            unit_test:
              coverage: true
              ignore_errors: false
              report_path: "**/TEST*.xml"
              enable: true
              coverage_report_path: "**/site/jacoco"
            command: mvn package -Dmaven.test.failure.ignore=true -U -e -X -B

The image can be in either of the following formats:

1. cloudbuild@maven3.5.3-jdk8-open, which starts with cloudbuild, uses @ as the separator, and is followed by the default image provided by CodeArts Build.

2. Complete SWR image path, for example, swr.example.example.com/codeci_test/demo:141d26c455abd6d7xxxxxxxxxxxxxxxxxxxx.

Configuration Description

Parameter

Type

Description

Mandatory

Default Value

settings

map

Setting for Maven builds.

No

None

cache

bool

Whether to enable cache.

No

false

command

string

Execute commands.

Yes

None

unit_test

map

Unit test.

No

None

Parameters for unit_test are described in the following table.

Parameter

Type

Description

Mandatory

Default Value

enable

bool

Whether to process test data.

No

true

ignore_errors

bool

Whether to ignore unit test errors.

No

true

report_path

String

Unit test data path.

Yes

None

converage

bool

Whether to process coverage data.

No

false

coverage_report_path

string

Coverage data path.

No

None