Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling the JAR Package

The binary packages available at the Kunpeng mirror site are compiled based on the open source code, and do not involve vulnerability or bug fixes.

When using open source software, comply with the applicable license agreements.

This document uses Dubbo as an example to describe how to deploy Java web applications. Therefore, Dubbo 2.7.5 must be compiled. For details, see Dubbo Porting Guide. You can create the dubbo-samples-api.jar package by compiling the code in this section or download it from the Huawei Cloud mirror site.

  1. Modify the pom.xml file.
    1. Go to the /home/dubbo-samples/dubbo-samples-api directory.
      1
      cd /home/dubbo-samples/dubbo-samples-api/
      
    2. Open the file.
      1
      vim pom.xml
      
    3. Press i to enter the insert mode and add the following content to <properties>:
      <maven-compiler-plugin.version>3.6.0</maven-compiler-plugin.version>
      <source.level>1.8</source.level>
      <target.level>1.8</target.level>

    4. Find the <build> module and replace it with the following content:
          <build>
              <finalName>dubbo-samples-api</finalName>
              <plugins>
                  <plugin>
                      <artifactId>maven-assembly-plugin</artifactId>
                      <executions>
                          <execution>
                              <phase>package</phase>
                              <goals>
                                  <goal>single</goal>
                              </goals>
                          </execution>
                      </executions>
                      <configuration>
                          <descriptorRefs>
                              <descriptorRef>jar-with-dependencies</descriptorRef>
                          </descriptorRefs>
                          <appendAssemblyId>false</appendAssemblyId>
                          <archive>
                              <manifest>
                                  <mainClass>org.apache.dubbo.samples.provider.Application</mainClass>
                                  <mainClass>org.apache.dubbo.samples.client.Application</mainClass>
                              </manifest>
                          </archive>
                      </configuration>
                  </plugin>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <version>${maven-compiler-plugin.version}</version>
                      <configuration>
                          <source>${source.level}</source>
                          <target>${target.level}</target>
                      </configuration>nn
                  </plugin>
              </plugins>
              <resources>
                  <resource>
                      <directory>src/main/</directory>
                      <includes>
                          <include>**/*.properties</include>
                      </includes>
                      <filtering>true</filtering>
                  </resource>
              </resources>
      </build>

    5. Press Esc, type :wq!, and press Enter to save the file and exit.
  2. Package the file.
    1
    mvn clean package
    

    If BUILD SUCCESS is displayed, the packaging is successful.

  3. View the generated dubbo-samples-api.jar package.
    1
    ll target/