下载jar包到本地仓库并且引入到maven中

手动将下载下来的 JAR 包添加到 Maven 的本地仓库。

一.下载jar包(下面推荐几个网址)

1.http://mvnrepository.com/

2.http://search.maven.org/

3.http://repository.sonatype.org/content/groups/public/

平常用第一个就够了,下面以第一个为例:

二.具体操作步骤

1.到 http://mvnrepository.com/ 这个网,在搜索栏中输入你要找的jar(比如:org.apache.poi.xwpf.converter.core),下面直接贴图:



2.选择jar版本(此处下载1.0.4)


3.下载jar并且复制依赖语句到项目的pom文件(依赖语句不可更改)


4.maven 安装jar包位置

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

mvn install:install-file -Dfile=D:\maven\apache-maven-3.0.4\repository\org\apache\poi\converter-core\1.0.4\org.apache.poi.xwpf.converter.core-1.0.4.jar -DgroupId=fr.opensagres.xdocreport -DartifactId=org.apache.poi.xwpf.converter.core -Dversion=1.0.4 -Dpackaging=jar


耐心之树,结黄金之果。

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Maven项目引入本地的jar包有两种方式。 第一种方式是将本地的jar包手动安装到本地Maven仓库,然后在项目的pom.xml文件添加相关的依赖。首先,将本地的jar包安装到Maven仓库,可以通过以下命令实现: ``` mvn install:install-file -Dfile=path/to/jarfile.jar -DgroupId=groupId -DartifactId=artifactId -Dversion=version -Dpackaging=jar ``` 其,`path/to/jarfile.jar`为本地jar包的路径,`groupId`为指定的组织ID,`artifactId`为项目ID,`version`为版本号。安装成功后,可以在项目的pom.xml文件添加以下依赖: ``` <dependency> <groupId>groupId</groupId> <artifactId>artifactId</artifactId> <version>version</version> </dependency> ``` 替换其的`groupId`、`artifactId`和`version`为实际的值。 第二种方式是通过使用Maven的system scope将本地的jar包引入到项目。在项目的pom.xml文件添加以下依赖: ``` <dependency> <groupId>groupId</groupId> <artifactId>artifactId</artifactId> <version>version</version> <scope>system</scope> <systemPath>path/to/jarfile.jar</systemPath> </dependency> ``` 同样,需要替换其的`groupId`、`artifactId`、`version`和`path/to/jarfile.jar`为实际的值。 需要注意的是,第一种方式可以保证在其他机器上构建项目时也能正确引入jar包,而第二种方式则需要保证在构建项目时本地的jar包路径是正确的。因此,推荐使用第一种方式将本地的jar包安装到Maven仓库

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值