欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

maven使用本地jar依赖并构建

程序员文章站 2022-06-18 19:57:09
...

1. 在项目下添加lib包

2. maven添加lib依赖

<dependency>
	<groupId>com.sf</groupId>
	<artifactId>XXX</artifactId>
	<version>1.0</version>
	<scope>system</scope>
	<systemPath>${project.basedir}/lib/XXX.jar</systemPath>
</dependency>

3. 修改build, 添加maven-dependency-plugin插件

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-dependency-plugin</artifactId>
	<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>
相关标签: java maven