Maven project fast packaging

Quickly package Maven projects

1. Add the following code in the pom file, pay attention to configure and run the main class

 <build>
     <plugins>
         <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-shade-plugin</artifactId>
             <version>3.2.4</version>
             <configuration>
                 <createDependencyReducedPom>true</createDependencyReducedPom>
             </configuration>
             <executions>
                 <execution>
                     <phase>package</phase>
                     <goals>
                         <goal>shade</goal>
                     </goals>
                     <configuration>
                         <transformers>
                             <transformer
                                     implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                 <!--配置运行主类-->
                                 <mainClass>YarnMonitor2</mainClass>
                             </transformer>
                         </transformers>
                     </configuration>
                 </execution>
             </executions>
         </plugin>
     </plugins>
 </build>

2、Clean+Install

insert image description here
insert image description here

Finish!

Guess you like

Origin blog.csdn.net/lafsca5/article/details/126033526