maven工程把依赖jar包一起打进来

每次开始build maven工程,都是本地IDE运行没有问题,打包后依赖的jar找不到class问题,原因是在build的时候,没有把依赖jar包含进来。只需要简单添加build部分即可:



[html]  view plain  copy
  1. <build>  
  2.         <plugins>  
  3.   
  4.   
  5.             <plugin>  
  6.                 <groupId>org.apache.maven.plugins</groupId>  
  7.                 <artifactId>maven-surefire-plugin</artifactId>  
  8.                 <version>2.17</version>  
  9.             </plugin>  
  10.   
  11.             <plugin>  
  12.                 <groupId>org.apache.maven.plugins</groupId>  
  13.                 <artifactId>maven-assembly-plugin</artifactId>  
  14.                 <version>2.2</version>  
  15.                 <configuration>  
  16.                     <appendAssemblyId>false</appendAssemblyId>  
  17.                     <descriptorRefs>  
  18.                         <descriptorRef>jar-with-dependencies</descriptorRef>  
  19.                     </descriptorRefs>  
  20.                     <archive>  
  21.                         <manifest>  
  22.                             <mainClass>com.framework.interf</mainClass>  
  23.                         </manifest>  
  24.                     </archive>  
  25.                 </configuration>  
  26.                 <executions>  
  27.                     <execution>  
  28.                         <id>make-assembly</id>  
  29.                         <phase>package</phase>  
  30.                         <goals>  
  31.                             <goal>assembly</goal>  
  32.                         </goals>  
  33.                     </execution>  
  34.                 </executions>  
  35.             </plugin>  
  36.   
  37.             <plugin>  
  38.                 <artifactId>maven-source-plugin</artifactId>  
  39.                 <version>2.1</version>  
  40.                 <configuration>  
  41.                     <attach>true</attach>  
  42.                 </configuration>  
  43.                 <executions>  
  44.                     <execution>  
  45.                         <phase>compile</phase>  
  46.                         <goals>  
  47.                             <goal>jar</goal>  
  48.                         </goals>  
  49.                     </execution>  
  50.                 </executions>  
  51.             </plugin>  
  52.   
  53.         </plugins>  
  54.     </build>  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值