写在前边
- 现在的时间:2019-04-08
- IDEA版本:2018.3
- JDK版本:1.8.0_181
- maven版本:3.6.0
打包步骤
第1步:在pom.xml
文件中添加以下两个插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.liyanxing.Main</mainClass> <!-- 入口类-->
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
注意
- 在pom文件中,所有的<plugin>标签要放在<plugins>标签内,而<plugins>标签标签又要放在<build>标签中。
- 注意配置自己的入口类。