Maven 导入本地Jar包
导入Jar包
在maven
项目根目录下新建名为lib
的文件夹,将准备好的外部jar
包移到该目录下。
配置Jar包依赖
使用pom.xml
文件scope
的system
属性来引入jar包:
0
1
2
3
4
5
6
|
<dependency>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/demo.jar</systemPath>
</dependency>
|
在这种方式下,如果需要打包发布,还需要额外配置:
0
1
2
3
4
5
6
7
8
9
10
|
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
|
相关文章