怎么实现将本地jar添加到Maven仓库(jar,maven,开发技术)

时间:2024-04-28 03:02:58 作者 : 石家庄SEO 分类 : 开发技术
  • TAG :

    %E6%80%8E%E4%B9%88%E5%AE%9E%E7%8E%B0%E5%B0%86%E6%9C%AC%E5%9C%B0jar%E6%B7%BB%E5%8A%A0%E5%88%B0Maven%E4%BB%93%E5%BA%93

希望大家仔细阅读,能够学有所成!

以下面pom.xml依赖的jar包为例:

实际项目中pom.xml依赖写法:

Maven 安装 JAR 包的命令是:

例如我的这个spring-context-support-3.1.0.RELEASE.jar 文件放在了"D:\mvn\"中

则命令为:

-DgroupId=org.springframework

-DartifactId=spring-context-support

-Dversion=3.1.0.RELEASE

-Dpackaging=jar

注意:任何路径和名称不要有中文和空格,以防出现莫名其妙的错误。

还可以解决本地仓库是从别人那边复制的,但是需要的jar包中央仓库不存在,导致的执行package时出现以下异常

Failed to execute goal on project relayserver: Could not resolve dependencies for project com.xxx:xxx:war:1.0-SNAPSHOT: Failure to find xxx.xxx:xxx:jar:1.0 in http://maven.aliyun
.com/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus-aliyun has elapsed or updates are forced

假设将包htmlparser.jar放入了项目下的lib目录中 :

则pom.xml文件中依赖可以如下:

手动向maven库里面添加jar包,要以管理员身份进行添加,在jar包目录打开cmd

mvn install:install-file -Dfile=文件绝对路径 -DgroupId=maven仓库下面的路径 -DartifactId=jar包名-Dversion=jar包版本 -Dpackaging=jar -DgeneratePom=true

例如:

本文:怎么实现将本地jar添加到Maven仓库的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:如何使用Go http重试请求下一篇:

22 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18