1.使用maven-assembly-plugin打包,将项目所有依赖包打为一个jar,适用于自己测试,或者项目小。pom具体配置如下:
<build>
<!-- 设置jar包名称 -->
<finalName>${
project.artifactId}-${
version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<!-- 设置main方法 -->
<manifest>
<mainClass>wf.stu.job.JobTest</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<!-- 打包时,省略assembly:single 直接运行maven clean package-->
<execution>
<id>make