Maven 发布jar包到本地库

来源:互联网 发布:网络安全产品 编辑:程序博客网 时间:2024/05/01 13:45

参考文献:

http://www.blogjava.net/fancydeepin/archive/2012/06/12/380605.html (Maven 手动添加 JAR 包到本地仓库)

http://www.yiibai.com/maven/include-library-manully-into-maven-local-repository.html (定制库到Maven本地资源库)


常用的Maven仓:http://mvnrepository.com/

我们进入Maven仓下载一个jar包


可以看到下面有关于maven的配置,给出这个 jar 包的 groupId,artifactId,version信息。这些信息是不需要我们去修改的。

<!-- https://mvnrepository.com/artifact/org.springframework/spring-context --><dependency>    <groupId>org.springframework</groupId>    <artifactId>spring-context</artifactId>    <version>4.3.5.RELEASE</version></dependency>

Maven 安装 JAR 包的命令:

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

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

jar包的位置:就是我们通过maven库下载的jar包存放在本地的位置,例如:D:\Maven

groupId:就是maven的groupId信息,如上面的xml的<groupId>标签中的信息

artifactld:就是maven的artifactld信息,如上面的xml的<artifactld>标签中的信息

version:就是maven的version信息,如上面的xml的<version>标签中的信息

在控制台输入

显示BUILD SUCCESS表示上传到本地仓成功


使用第三方jar最常用的方法就是这个,这样就能够从你的 Maven 本地存储库检索

0 0
原创粉丝点击