User Guide

Instructions

To use the Maven plug-in, log in to ServiceStage, create an application component, and release the JAR or WAR package of a module in the project following 2 and 3.

To release a module, modify the configuration of the module.

  • Scenario 1: One project has only one module.
    ├──Myproject
        ├──src...
        ├──pom.xml      Add the ServiceStage plug-in configuration to the pom.xml file.
        └──servicestage.yaml   Configure parameters required by the ServiceStage plug-in.
  • Scenario 2: A project has multiple modules. If you want to upgrade a module, for example, module-B, configure the servicestage.yaml file of module-B. If multiple modules need to be upgraded, configure the servicestage.yaml file of the corresponding modules.
    ├──Myproject
    │    ├──module-A
    │    │       ├──src...
    │    │       └──pom.xml
    │    │
    │    ├──module-B
    │    │       ├──src...
    │    │       ├──pom.xml      Add the ServiceStage plug-in configuration to the pom.xml file.
    │    │       └──servicestage.yaml   Configure parameters required by the ServiceStage plug-in.
    │    │
    │    └──module-C
    │            ├──src...
    │            └──pom.xml
    └──pom.xml

Maven Compilation Commands

The servicestage-maven-plugin allows the mvn compilation command to transfer parameters through environment variables. During the use, the environment variables of the mvn compilation command are preferentially used, and then the variables in the servicestage.yaml file are used. Command example:

mvn clean package -Diam.domain=xxx -Diam.username=xxx  -DmavenPlugin.pluginSkip=false 

Example

  1. Log in to ServiceStage, choose Application Management > Application List, and click Create Application. If an application has been created, click the created application.
  2. After the application is created, click Create Component. (If a component has been created, skip this step.)

  3. Create a web component and set Runtime System to Tomcat8 or Java8. Set this parameter based on the site requirements. For example, if the JAR package is used, set this parameter to Java8.

  4. After the component is created and deployed, click the component in the Environment view to view the component details.
  5. Find the application ID, component ID, and instance ID in the address bar. For example:

    https://console.huaweicloud.com/servicestage/?region=cn-south-1#/apps/applications/info/6d8065ea-45b1-44b2-a661-58fb1abb5d0a/0936177c-733c-433e-a633-25e6973d4153/948da446-9ffb-44f0-b4c4-17c614378294/test-maven/overview

    The application ID, component ID, and instance ID are as follows:

    application ID: 6d8065ea-xxxx

    component ID: 0936177c-xxxxx

    instance ID: 948da446-xxxx

  6. Download the compressed package on which the Maven plug-in depends and decompress the package to the local Maven repository.

  7. For details about how to set parameters for a local project, see the tool configuration description in the Tool Introduction.

  8. Compile and package the code.

    When the mvn command is used to compile a software package, the tool upgrades the software package compiled for the project to the specified application.

  9. Check the application component upgrade result.

    After the upgrade is complete, access the application and compare the results before and after the upgrade.

    After the upgrade is complete, access the application components, as shown in the following figure.