四、Maven项目核心POM .xml
pom定义了项目的基本信息,描述了项目的构建、依赖
1、Maven项目的基本坐标:
<!-- 项目包名: 公司地址名称反写+项目名称-->
<groupId>com.xusan</groupId>
<!--项目模块名称:一般为 项目名-模块名 -->
<artifactId>hello-word</artifactId>
<!-- 指定当前pom 的版本-->
<version>1.0-SNAPSHOT</version>
2.POM插件配置
(1).查看官方配置文档
官网ManifestResourceTransformer配置
(2).配置pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xusan</groupId>
<artifactId>hello-word</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>hello-word</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.xusan.helloword.HelloWord</Main-Class>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
只要修改包名即可
<manifestEntries>
<!--改成包名-->
<Main-Class>com.xusan.helloword.HelloWord</Main-Class>
</manifestEntries>