安装具有传递依赖关系/依赖关系树的第三方图书馆? [英] Install 3rd Party Libraries with Transitive Dependencies / Dependency Tree?

查看:71
本文介绍了安装具有传递依赖关系/依赖关系树的第三方图书馆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Maven新手,花了几个小时来学习基础知识,但是我仍然没有找到任何好的文档来了解如何在本地安装具有所有(传递)依赖项的3rd Party JAR.

I am a Maven newbie and spent hours to learn the basics, but I still have not found any good documentation how to install locally a 3rd Party JAR with all its (transitive) dependencies.

我知道mvn install:install-file确实安装了一个JAR.但是如何在本地存储环境中进行类似这样的操作:

I know mvn install:install-file does install a single JAR. But how to install locally in the repsoitory something like this:

+ Parent.jar
  + ChildA.jar (Requuired by Parent)
    + ChildB.jar (Required by Child A)

使其更加复杂和真实:Parent.jar和ChildA.jar是遗留/商业Jars,在公共Maven存储库中不可用,但是Child B是在公共存储库中找到的jar(例如,像日志记录器).

To make it more complcated and real life: Parent.jar and ChildA.jar are legacy/commercial Jars not available in the public maven Repository but the Child B is a jar that is found in the public repository (for example like a logging jar).

更新:我不仅要在本地安装它们(具有系统依赖性),而且还想正确地"用maven对其进行集成,以便我可以将此依赖性树重新分发给其他开发人员或公众(而且我认为这很重要) for maven),以便maven知道并理解Dependecytree(避免版本冲突,不必要的下载等...)

UPDATE: I do not only want to install them locally (with a system dependency) but to also "correctly" integregrate them with maven so i can redistribute this dependency tree to other developers or the public (and I assume this is important for maven), so that maven knows and understands the dependecytree (to avoid version conflicts, unnecessary downloads etc...)

任何链接或信息都将说明如何做到这一点非常好.

Any links or information how that exaclty describe how this can be done would be great.

非常感谢!! 标记

推荐答案

如果是商业jar,则将其部署到中央存储库中可能会违反许可,唯一的办法是将其部署到公司的存储库中.回购(如果您有一种设置).

If it's a commercial jar, you may be in violation of the license if you deploy it to a central repository, and the only recourse is to deploy to your company's repo (if you have one setup).

为此,您需要为childA定义pom,将childB指定为依赖项,然后为此运行install:install-file目标.然后对父节点执行相同的操作,并使用childA作为其依赖项.

In order to do that you need to define a pom for childA, specifying childB as a dependency, then run the install:install-file goal for that. Then do the same for parent, with childA as it's dependency.

一旦这样做,您就可以将这些物品拿走,并通过GUI轻松地将它们上传到公司的中央仓库(Nexus和Artifactory都通过GUI对此进行支持).

Once you do that, you can then take those items, and upload them pretty easily to your company's central repo through it's GUI (both Nexus and Artifactory support this through the GUI).

这篇关于安装具有传递依赖关系/依赖关系树的第三方图书馆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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