1. 添加pom
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.tang.CSVUtils</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>
jar-with-dependencies
</descriptorRef>
</descriptorRefs>
</configuration>
<!-- 加上下面这一段,使用 mvn package命令,不加则使用mvn assembly-->
<execution>
<id>make-assemble</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</plugin>
</plugins>
</build>
2. 打包
D:\projects\sunshine>mvn clean package
3. 运行
java -jar target/spring-boot-scheduler-1.0.0.jar
原文地址:https://www.cnblogs.com/anenyang/p/10361389.html