Bu sayfa henüz yerel dilinizde mevcut değildir. Daha fazla dil seçeneği eklemek için yoğun bir şekilde çalışıyoruz. Desteğiniz için teşekkür ederiz.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Building with Maven

Updated on 2025-01-03 GMT+08:00

Build a Java project with Maven.

Build on GUI

Add Build with Maven, when configuring build actions. Set the parameters according to Table 1.

Table 1 Parameters for building with Maven

Parameter

Description

Action Name

Assign a custom name to the build action. The name can contain:

  • Letters, digits, hyphens (-), underscores (_), commas (,), semicolons (;), colons (:), periods (.), slashes (/), and parentheses.
  • 1 to 128 characters.

Tool Version

Select a tool version that matches your current development environment.

For tool versions supported by CodeArts Build, see build tools and versions. If the current tools and versions do not meet your requirements, you can customize a build environment.

Commands

Configure the Maven commands, or use the default ones. For more commands, see the Maven official website.

Continue After Failure

Specify whether to proceed after the current action fails by setting the parameter to either Yes or No.

setting File Configuration

  • Generate setting File with Repositories: The optimal repository access mode is automatically configured based on your IP address when you access the setting.xml file provided by CodeArts.

    Your IP address may be in regions in or outside the current country. You are advised to retain the default settings.

    The setting.xml file defines the default dependency pull sequence and mirror source proxy. If you need to use a custom setting.xml file, add a custom setting.xml file and add --settings settings.xml to the end of the default packaging command. Then, you can use the added settings.xml file to build with Maven.

  • Public Repositories: By default, Huawei Mirrors is added, and Huawei SDK repositories has been configured. This configuration is used only when you need to add a public repository that is not provided by CodeArts. The procedure is as follows:
    1. Click Add.
    2. Enter the repository address, and select Release and Snapshot as required. Select either Release or Snapshot, or both.

      Release: If this option is selected, the build process attempts to download the release version dependency from the repository.

      Snapshot: If this option is selected, the build process attempts to download the snapshot version dependency from the repository.

  • Private Repositories: Self-hosted repos provided by CodeArts have been configured by default. This configuration is used only when you need to add other private repository. The procedure is as follows:
    1. Create a Nexus repository service endpoint.
    2. Click Add, select the service endpoint created in the previous step, and select Release and Snapshot as required.
NOTE:

Release and Snapshot are two types of repositories. Pay attention to their differences. If you upload a dependency to a release repository, it cannot be downloaded during a build.

  • Snapshot: For private dependency packages released for debugging, add the -SNAPSHOT suffix to the dependency version (for example, 1.0.0-SNAPSHOT). During each release, the dependency is automatically released to the snapshot repository. The version does not need to be updated each time the dependency is released. You can add the -U parameter to the build command to obtain the latest version.
  • For officially released private dependency packages, do not add the -SNAPSHOT suffix to the dependency version (for example, 1.0.0). During each release, the dependency is automatically released to the release repository. The version must be updated each time the dependency is released. Otherwise, the latest dependency package cannot be obtained during the build.

Release to Self-hosted Repos

By default, CodeArts Build uses the self-hosted repos as the download source of private dependency. The configuration is required for uploading build products to the self-hosted repos and store the build products as dependencies for other projects. Before the configuration, create a self-hosted repo. The configuration procedure is as follows:

  • Do not configure POM: Private dependencies do not need to be released to the self-hosted repo of CodeArts Artifact.
  • Configure all POMs: Deployment configurations are added to all pom.xml files of the project. The mvn deploy command is used to upload the built dependency package to a self-hosted repo.

    In the command window, use the number sign (#) to comment out the mvn package -Dmaven.test.skip=true -U -e -X -B command, as shown in the following figure.

    Delete the number sign (#) before the #mvn deploy -Dmaven.test.skip=true -U -e -X -B command, as shown in the following figure.

The uploaded private dependency can be referenced by adding the groupId, artifactId, and version coordinates in the pom.xml file to other projects.

Unit Test

To process unit test results, set the parameters. For details, see Configuring a Unit Test.

Cache

Opt to use the cache to improve the build speed. If you set Use Dependency Cache to Yes, the downloaded dependency package is cached during each build. In this way, the dependency package does not need to be pulled repeatedly during subsequent builds, which effectively improves the build speed.

NOTE:

After the dependency package built by Maven is stored in the cache, the cache directory is updated only when a new dependency package is introduced to the project built by the tenant. The existing dependency package cache file cannot be updated.

Build with Code

Modify the code in the BUILD block in Creating a YAML File for Your Code-based Build by referring to the following sample code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
version: 2.0 # The value must be 2.0.
steps:
  BUILD:
    - maven:
          image: cloudbuild@maven3.5.3-jdk8-open
          inputs:
            settings:
              public_repos:
                - https://mirrors.example.com/maven
            cache: true # Determine whether to enable caching.
            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
            ignore_fail: true
Table 2 Parameters in the sample code

Parameter

Type

Description

image

String

The image address can be in either of the following formats:

  • Use cloudbuild@maven3.5.3-jdk8-open. This address starts with cloudbuild and uses the at sign (@) as a separator, with the default image version provided by CodeArts Build following it.
  • Use a complete SWR image path, for example, swr.example.example.com/codeci_test/demo:141d26c455abd6d7xxxxxxxxxxxxxxxxxxxx.

settings

Map

Optional. If this parameter is not set, the setting.xml file provided by CodeArts is used by default. If you need to use a custom settings.xml file, add a custom setting.xml file and add --settings settings.xml to the end of the default packaging command mvn package -Dmaven.test.failure.ignore=true -U -e -X -B.

cache

Bool

Optional.

Specify whether to enable cache.

  • true: Enable.
  • false: Disable.

The default value is false.

command

String

Configure the Maven command. For more commands, see the Maven official website.

unit_test

Map

Optional.

Configure the unit test. For details, see Configuring a Unit Test.

ignore_fail

String

Whether to proceed after the current action fails.
  • true: Yes
  • Empty: No

Adding a Custom setting.xml File

  • Build on GUI
    1. In the Commands window of the Build with Maven action, run the cat /home/build/.m2/settings.xml command. After the task is complete, the content of the settings.xml file will be displayed in the build logs.
    2. Customize a new settings.xml file according to the settings.xml file's information displayed in the build logs.
    3. Add the Download File from File Manager action before the Build with Maven action.

      Assign a custom name to the action and select a tool version. Currently, only shell4.2.46-git1.8.3-zip6.00 is supported.

    4. Click Upload. In the displayed dialog box, select the file created in 2, add a description, select the agreements, and click Save.
    5. Expand the File Name drop-down list and select the uploaded setting.xml file.
  • Build with Code
    Modify the code in the BUILD block in Creating a YAML File for Your Code-based Build by referring to the following sample code:
    1
    2
    3
    4
    5
    6
    7
    version: 2.0 # The value must be 2.0.
    steps:
      BUILD:
        - download_file:
              inputs:
                name: settings.xml
                ignore_fail: true
    
    Table 3 Parameters in the sample code for downloading a file

    Parameter

    Type

    Description

    name

    String

    Name of the setting file.

    ignore_fail

    String

    Whether to proceed after the current action fails.

    • true: Yes
    • Empty: No
NOTE:
  • The maximum file size is 100 KB.
  • The file type must be .xml, .key, .keystore, .jks, .crt, or .pem.
  • A maximum of 20 files can be uploaded.
You can access the uploaded files in either of the two ways.
  • On the CodeArts Build homepage, click More and select Files.
  • Alternatively, click Manage Files in the Download File From File Manager action.
On the Files page, you can edit, download, and delete files, as well as configure operation permissions for other users.
  • Enter a keyword in the search box to search for a file.
  • Click in the Operation column to modify the file name and specify whether to allow all members of your account to use the file in CodeArts Build.
  • Click in the Operation column to download the file.
  • Click in the Operation column and select Delete from the drop-down list. Confirm the deletion as prompted.
  • Click in the Operation column and select Modify Permissions from the drop-down list. In the displayed dialog box, configure file operation permissions for the user.
    Figure 1 Configuring file operation permissions for a user
    Table 4 Roles and their permissions on files

    Permission

    Role with the Permission

    Add users

    All users in the project

    View a file

    File creator and users under the same account

    Use a file

    File creator and users with the use permissions configured by the file creator

    Update a file

    File creator and users with the update permissions configured by the file creator

    Delete a file

    File creator and users with the delete permissions configured by the file creator

    Modify permissions

    File creator

    NOTE:

    By default, the creator has all permissions, which cannot be deleted or modified.

Sitemizi ve deneyiminizi iyileştirmek için çerezleri kullanırız. Sitemizde tarama yapmaya devam ederek çerez politikamızı kabul etmiş olursunuz. Daha fazla bilgi edinin

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback