第一种方式:将依赖包打包进一个jar包中。
<build><plugins><plugin><artifactId>maven-compiler-pluginartifactId><configuration><source>1.8source><target>1.8target><encoding>${project.build.sourceEncoding}encoding> configuration>plugin><plugin> <artifactId>maven-assembly-pluginartifactId> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependenciesdescriptorRef> descriptorRefs> <archive> <manifest> <mainClass>mainClass> manifest> archive> configuration> <executions> <execution> <id>make-assemblyid> <phase>packagephase> <goals> <goal>singlegoal> goals> execution> executions> plugin> plugins>build>
第二种方式: 将依赖包单独放到lib文件夹中
2.3.2 maven-compiler-plugin 1.8 1.8 UTF- 8org.apache.maven.plugins maven-dependency-plugin copy-dependencies prepare-package copy-dependencies ${project.build.directory}/lib false false true 2.4 org.apache.maven.plugins maven-jar-plugin true lib/