如何将本地jar文件添加到Maven项目? [英] How to add local jar files to a Maven project?

查看:505
本文介绍了如何将本地jar文件添加到Maven项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何直接在项目的库源中添加本地jar文件(尚未成为Maven存储库的一部分)?

How do I add local jar files (not yet part of the Maven repository) directly in my project's library sources?

推荐答案

按如下方式将JAR安装到本地Maven存储库中:

Install the JAR into your local Maven repository as follows:

mvn install:install-file \
   -Dfile=<path-to-file> \
   -DgroupId=<group-id> \
   -DartifactId=<artifact-id> \
   -Dversion=<version> \
   -Dpackaging=<packaging> \
   -DgeneratePom=true

每个指的是:


< path-to-file>:要加载的文件的路径,例如 - > c:\ kaptcha-2.3.jar

Where each refers to:

< path-to-file >: the path to the file to load e.g -> c:\kaptcha-2.3.jar

< group-id>:文件应在例如com.google.code

< group-id >: the group that the file should be registered under e.g -> com.google.code

< artifact-id>:文件的工件名称,例如 - > kaptcha

< artifact-id >: the artifact name for the file e.g -> kaptcha

< version>:文件的版本,例如 - > 2.3

< version >: the version of the file e.g -> 2.3

<包装>:文件的包装,例如 - > jar

< packaging >: the packaging of the file e.g. -> jar

参考

这篇关于如何将本地jar文件添加到Maven项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆