Maven 本地 jar

有时 maven 上的是私库,然后需要部署到外部环境,没有这个jar,就需要如下操作。

mvn dependency:copy-dependencies -DoutputDirectory=src/main/resources/lib

会把全部依赖包放到 res 的 lib 下

<dependency>
    <groupId>com.sample</groupId>
    <artifactId>sample</artifactId>
    <version>1.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/lib/sample-1.0.jar</systemPath>
</dependency>

在pom.xml 中加上 systemPath 这个元素

这样就是这个jar包就可以本地用了

build 的还要用

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<includeSystemScope>true</includeSystemScope>
				</configuration>
			</plugin>
		</plugins>
	</build>

猜你喜欢

转载自blog.csdn.net/YYecust/article/details/88818439