简体   繁体   English

如何将特定 URL(非本地)的外部 jar 添加到 Maven 项目?

[英]How to add external jar at a specific URL (NOT LOCAL) to a maven project?

I can find a lot of questions on how to import an external jar, already on the machine, in a maven project.我可以找到很多关于如何在 maven 项目中导入机器上已经存在的外部 jar 的问题。

But how can I do that for a jar downloadable via an URL ?但是,对于可通过 URL 下载的 jar,我该如何做到这一点?

I've checked the following , but it is only for local jars.我已经检查了以下内容,但它仅适用于本地罐子。

Moreover, the following has no information about urL or any non local source.此外, 以下没有关于 url 或任何非本地来源的信息。

Is there any example, or can you provide one, showing how to do such a thing if it is possible ?是否有任何示例,或者您能否提供一个示例,展示如何在可能的情况下执行此类操作?

For example, with my jar at http://myjar.com/myjardownload例如,我的 jar 位于http://myjar.com/myjardownload

Does something like this exist ?这样的东西存在吗?

<dependency>
            <groupId>mysuperjar</groupId>
            <artifactId>jar-super-nice</artifactId>
            <url>http://myjar.com/myjardownload</url>
</dependency>

No.不。

You need to download the jar and upload it to your company Nexus/Artifactory.您需要下载 jar 并将其上传到您公司的 Nexus/Artifactory。

Alternatively, install it into your local repository.或者,将其安装到本地存储库中。

The best alternative is to find out whether this jar can be drawn from any Maven repository on the internet and then add that Maven repository either to your settings.xml or to your company Nexus/Artifactory.最好的选择是找出这个 jar 是否可以从 Internet 上的任何 Maven 存储库中提取,然后将该 Maven 存储库添加到您的settings.xml或您公司的 Nexus/Artifactory。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM