如何让我的 Maven 项目依赖于非 Maven 项目? [英] How to make my maven project depend on non maven projects?

查看:66
本文介绍了如何让我的 Maven 项目依赖于非 Maven 项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个 maven 项目,该项目必须依赖于一个非 maven 项目,而该项目又依赖于其他 2 个非 maven 项目.我没有任何其他项目的所有权,我不可能更改这些项目中的任何内容,更不用说结构以符合 Maven 结构了.

I want to create a maven project, which has to depend on a non maven project which in turn depends on 2 other non maven projects. I do not have ownership of any of the other projects and it would not be possible for me to change anything in those projects let alone the structure to conform to the maven structure.

我问我是否可以只获取 jars——但被告知由于多个级别的依赖,这将是困难的"——尽管我不明白为什么.

I asked if I could just get jars -- but was told that because of multiple levels of dependency, it would be "difficult" -- although I haven't understood why.

这是可能的还是我应该放弃使用 maven 来创建我的项目并使用 lib 文件夹中带有 jar 的常规项目?

Is this possible or should I just abandon the use of maven to create my project and go with a regular project with jars in the lib folder?

无情

推荐答案

如果您可以使用常规项目构建,那意味着您必须有权访问其他项目的 jar 文件吗?

If you can go with a regular project build that means you must have access to the other project's jar files?

其他项目如何构建它们并不重要,您仍然可以通过将您依赖的 jar 加载到 Maven 存储库中来更好地控制自己的构建过程.

It doesn't really matter how the other project builds them, you can still gain more control over your own build process by loading the jars you depend on into a Maven repository.

我建议使用以下存储库管理器之一:

I'd suggest using one of the following repository managers:

他们会为您提供上传第 3 方 jar 的管理屏幕,他们还将提供一种更有效的方式来使用其他 Maven 存储库,例如 Maven 中心.

They'll give you management screens to uploading 3rd party jars, they'll also a more efficient way to use other Maven repositories like Maven Central.

一旦您的 Maven 构建过程开始运行,您就可以鼓励其他项目自动将它们的版本发布到您的 Maven 存储库中.他们可以使用 MavenApache ivy 项目.最坏的情况是,您只需继续加载他们的库,直到他们看到曙光:-)

Once you've got your Maven build process working, you could encourage the other projects to automatically publish their versions into your Maven repo. They could use the ANT tasks provided by the Maven or Apache ivy projects. Worst case you just continue to load their libraries until they see the light :-)

这篇关于如何让我的 Maven 项目依赖于非 Maven 项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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