这期内容当中小编将会给大家带来有关Maven项目实现打Jar包并添加依赖,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
使用maven-dependency-plugin插件
子项目中的pom.xml文件中,添加以下maven-dependency-plugin依赖,这个maven-dependency-plugin依赖的作用就是自动拷贝jar包到target目录
这是我的Maven子项目打包,指定了将它的依赖的父项目中的jar包拷贝到target下的lib目录
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-dependencies</id> <phase>prepare-package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <!-- ${project.build.directory}为Maven内置变量,缺省为target --> <outputDirectory>${project.build.directory}/lib</outputDirectory> <overWriteReleases>true</overWriteReleases> <overWriteSnapshots>true</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions> </plugin>
当前题目:Maven项目实现打Jar包并添加依赖-创新互联
地址分享:https://www.cdcxhl.com/article30/phjpo.html
成都网站建设公司_创新互联,为您提供外贸网站建设、电子商务、商城网站、Google、网站设计公司、外贸建站
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联