在配置文件里加入如下配置:
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.smart.App</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
执行方法:
clean compile assembly:single
会在项目的target目录下生成一个xxx-jar-with-dependencies.jar的jar文件,双击运行即可!