Maven:包括在公共存储库中找不到的jar [英] Maven: Including jar not found in public repository

查看:100
本文介绍了Maven:包括在公共存储库中找不到的jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我要使用不在maven公共存储库中的第三方库,那么将其作为依赖项包含在我的项目中的最佳方法是什么,以便当别人检出我的代码时,它仍然可以构建?



ie



我的应用程序A取决于在公众中不存在的jarB库。然而,我希望将B作为依赖关系添加到A,以便当世界另一方的人可以查看代码,并仍然可以构建A

解决方案

您可以自己安装项目。



或者您可以使用系统范围如下:

 < dependency> 
< groupId> org.group.project< / groupId>
< artifactId> Project< / artifactId>
< version> 1.0.0< / version>
< scope> system< / scope>
< systemPath> $ {basedir} /lib/project-1.0.0.jar</systemPath>
< / dependency>

systemPath 需要项目的绝对路径。为了更容易,如果jar文件位于资源库/项目中,则可以使用绑定到项目根目录的 $ {basedir} 属性。 p>

If I was to use a 3rd party library that was not in the maven public repository, what is the best way to include it as dependency for my project so that when someone else checks out my code it will still be able to build?

i.e.

My Application "A" depends on jar "B" which does not exist in the public repository. I, however, wish to add "B" as a dependency to "A" such that when a person on the other side of the world could check out the code and still be able to build "A"

解决方案

You can install the project yourself.

Or you can use the system scope like the following:

<dependency>
    <groupId>org.group.project</groupId>
    <artifactId>Project</artifactId>
    <version>1.0.0</version>
    <scope>system</scope>
    <systemPath>${basedir}/lib/project-1.0.0.jar</systemPath>
</dependency>

systemPath requires the absolute path of the project. To make it easier, if the jar file is within the repository/project, you can use ${basedir} property, which is bound to the root of the project.

这篇关于Maven:包括在公共存储库中找不到的jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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