本地jar安装到maven仓库 和 ivy仓库方法

本文详细介绍了如何将本地jar文件引入Maven仓库,并通过Ivy仓库进行本地化管理。包括引入步骤、注意事项以及相关配置文件的使用。适合Java开发人员学习。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一:已java_memcached-release_2.6.6.jar 本地jar举例

二:操作

1:把 java_memcached-release_2.6.6.jar 放入D盘

2:cmd命令执行

mvn install:install-file -Dfile=d:/java_memcached-release_2.6.6.jar -DgroupId=com.danga -DartifactId=memcached -Dversion=2.6.6 -Dpackaging=jar -DgeneratePom=true

3:pom.xml 文件引入

  <dependency>
            <groupId>com.danga</groupId>
            <artifactId>memcached</artifactId>
            <version>2.6.6</version>
        </dependency>

 

三:注意事项!

开发工具的maven引入一定是要引入的是你自己的安装的maven

四:如果是ivy导入本地仓库

已导入 

<dependency org="com.shfft" name="fft-shield" rev="1.0" conf="zip->default" />

为例子

 

手动在 本地ivy仓库下,新建图中标记的目录

其中jars中放入

其中ivy-1.0.xml内容

 

<?xml version="1.0" encoding="UTF-8"?> <ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven"> <info organisation="com.shfft" module="fft-shield" revision="1.0" status="release" publication="20140603162722329" > <description homepage=""> POM was created by Sonatype Nexus </description> </info> <configurations> <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/> <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/> <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/> <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/> <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/> <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/> <conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/> <conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/> <conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/> <conf name="optional" visibility="public" description="contains all optional dependencies"/> </configurations> <publications> <artifact name="fft-shield" type="jar" ext="jar" conf="master"/> </publications> </ivy-module> 

 

 

ivy-1.0.xml.original文件内容

 

<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>com.shfft</groupId> <artifactId>fft-shield</artifactId> <version>1.0</version> <description>POM was created by Sonatype Nexus</description> </project> 

 

 

 

自己根据jar包的信息修改

 

最后重新引入一下ivy仓库

!注意其中xml文件名称中 1.0要和jar版本号对应

 

后续有很多开发填坑的文章发布,如果对你有帮助,请支持和加关注一下

http://e22a.com/h.05ApkG?cv=AAKHZXVo&sm=339944

https://shop119727980.taobao.com/?spm=0.0.0.0 

 

转载于:https://my.oschina.net/baishi/blog/656468

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值