出自 http://blog.csdn.net/chujiujiao/article/details/8913952
1. 在pom.xml加入如下插件
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- <archive>
- <manifest>
- <mainClass>com.funny_square_webapp.App</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- </plugins>
- </build>
2. 运行 mvn assembly:assembly
3. 在命令行中运行如下命令
- D:\work_project\eclipse_workspace\FunnySquareWebapp\target>java -jar FunnySquare
- Webapp-1.0.1-jar-with-dependencies.jar