使用Maven-JAR-插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<!-- Configures the content of the created manifest -->
<manifest>
<!-- Adds the classpath to the created manifest -->
<addClasspath>true</addClasspath>
<!-- Specifies that all dependencies of our application are found -->
<!-- Configures the main class of the application -->
<mainClass>xxx.zzz.yyy.MainClass</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
希望这会有所帮助。