本文主要是介绍maven引入本地jar包并打包,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
maven引入本地jar包并打包
1、在项目根目录下创建一个lib文件夹,把本地jar包拷贝到lib文件夹下
2、pom文件中增加配置
<dependencies><dependency><groupId>com.aspose</groupId><artifactId>aspose.slides</artifactId><version>15.9.0</version><scope>system</scope><systemPath>${project.basedir}/lib/aspose.slides-15.9.0.jar</systemPath></dependency><dependency><groupId>com.aspose.cad</groupId><artifactId>aspose-cad</artifactId><version>20.4</version><scope>system</scope><systemPath>${project.basedir}/lib/aspose-cad-20.4.jar</systemPath></dependency><dependency><groupId>com.aspose.cells</groupId><artifactId>aspose-cells</artifactId><version>8.5.2</version><scope>system</scope><systemPath>${project.basedir}/lib/aspose-cells-8.5.2.jar</systemPath></dependency><dependency><groupId>com.aspose.words</groupId><artifactId>aspose-words</artifactId><version>18.5.0718</version><scope>system</scope><systemPath>${project.basedir}/lib/aspose-words-18.5.0718-jdk16.jar</systemPath></dependency></dependencies><build><!--普通maven项目如下配置--><finalName>xxx</finalName><defaultGoal>compile</defaultGoal><plugins><!--maven把本地jar包打包到war中--><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><version>2.5.1</version><executions><execution><id>copy-dependencies</id><phase>compile</phase><goals><goal>copy-dependencies</goal></goals><configuration><outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory><includeScope>system</includeScope></configuration></execution></executions></plugin></plugins><!--springboot项目如下配置--><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><!--打包的时候把标注为<scope>system</scope>的jar包一块打包进去--><configuration><includeSystemScope>true</includeSystemScope></configuration></plugin></plugins></build>
这篇关于maven引入本地jar包并打包的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!