菜单

Administrator
Administrator
发布于 2023-11-07 / 26 阅读 / 0 评论 / 0 点赞

maven项目加入本地jar依赖

  • 在pom文件中使用本地路径

<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>sdk.core</artifactId>
    <version>3.3.1</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/aliyun-java-sdk-core-3.3.1.jar</systemPath>
</dependency>

注意,这种方式需要在<plugin>标签中加入:

<configuration>
    <includeSystemScope>true</includeSystemScope>
</configuration>
  • 使用maven将jar包加入到.m2下的repository路径中

运行以下命令

mvn install:install-file -Dfile=jar包的位置 -DgroupId=上面的groupId -DartifactId=上面的artifactId -Dversion=上面的version -Dpackaging=jar

或者

mvn install:install-file -Dfile=jar位置 -DpomFile=pom文件位置
  • 使用IDE 工具

在IDEA中,通过Modules的Dependencies添加,点击右边绿色+号,然后选择地址即可。


评论