有些项目会用到一些Maven库上没有的jar包,这就需要我们自己引入了。
这种情况有三种办法:
<dependency>
<groupId>com.aliyungroupId>
<artifactId>sdk.coreartifactId>
<version>3.3.1version>
<scope>systemscope>
<systemPath>${project.basedir}/lib/aliyun-java-sdk-core-3.3.1.jarsystemPath>
dependency>
注意:
1.添加 system
2.systemPath这个路径是jar包的路径。${project.basedir}只是一个系统自己的常量。
3.使用这种方式,在将项目用Maven打包是需要在 < plugin > 标签中加入:
<configuration>
<includeSystemScope>trueincludeSystemScope>
configuration>
也就是:
<plugin>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-maven-pluginartifactId>
<configuration>
<includeSystemScope>trueincludeSystemScope>
configuration>
plugin>
mvn install:install-file -Dfile=jar包的位置 -DgroupId=上面的groupId -DartifactId=上面的artifactId -Dversion=上面的version -Dpackaging=jar
这种方式需要电脑上安装并配置了maven
IDEA:
通过Modules的Dependencies添加
点击右边绿色 + 号
然后选择地址即可。
https://www.cnblogs.com/tangshengwei/p/6341628.html