maven-jar-plugin将指定包目录打成单独的jar包
项目依赖的所有jar包导出到lib目录下
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.2.0</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <useUniqueVersions>false</useUniqueVersions> <classpathPrefix>lib/</classpathPrefix> <mainClass>cn.xk.dp.weixin.Driver</mainClass> </manifest> <manifestEntries> <!--将ojdbc8-1.0.jar写进MANIFEST.MF文件中的Class-Path--> <Class-Path>lib/ojdbc8-1.0.jar</Class-Path> </manifestEntries> </archive> <excludes> <!--排除用于测试的日志配置资源文件--> <exclude>log4j2-test.xml</exclude> </excludes> </configuration> </plugin> <!--在打包阶段将依赖的jar包导出到lib目录下--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-dependencies</id> <phase>package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <type>jar</type> <includeTypes>jar</includeTypes> <outputDirectory>${project.build.directory}/lib</outputDirectory> </configuration> </execution> </executions> </plugin> </plugins> </build>