利用maven-dependency-plugin插件进行依赖包的复制
pom.xml文件中添加
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
assembly.xml文件中增加
<fileSet>
<directory>${project.build.directory}/lib</directory>
<outputDirectory>lib</outputDirectory>
<directoryMode>0744</directoryMode>
<fileMode>0644</fileMode>
</fileSet>
这样就可以将target包中的lib包中的全部jar包复制到打的jar压缩包中的lib包中