maven 生成可运行的jar

来源:互联网 发布:daum potplayer mac版 编辑:程序博客网 时间:2024/04/30 14:22

出自 http://blog.csdn.net/chujiujiao/article/details/8913952

1. 在pom.xml加入如下插件

[html] view plain copy
  1.   <build>    
  2.   <plugins>    
  3.     <plugin>    
  4.       <artifactId>maven-assembly-plugin</artifactId>    
  5.       <configuration>    
  6.         <descriptorRefs>    
  7.           <descriptorRef>jar-with-dependencies</descriptorRef>    
  8.         </descriptorRefs>   
  9.         <archive>    
  10.           <manifest>    
  11.             <mainClass>com.funny_square_webapp.App</mainClass>    
  12.           </manifest>    
  13.         </archive>             
  14.       </configuration>    
  15.     </plugin>    
  16.   </plugins>    
  17. </build>   

2. 运行 mvn assembly:assembly 

3. 在命令行中运行如下命令 

[html] view plain copy
  1. D:\work_project\eclipse_workspace\FunnySquareWebapp\target>java -jar FunnySquare  
  2. Webapp-1.0.1-jar-with-dependencies.jar  
0 0
原创粉丝点击