Maven私有依赖 [英] Maven private dependencies

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

问题描述

有没有办法为其他人不可见的项目指定私人依赖关系?

Is there a way to specify private dependency for a project that will not be visible to others?

我想要实现的是几乎相当于但是有一点微不足道 - 用户不应该意识到依赖关系,因此不必明确地使用这种排除。

What I'm trying to achieve is pretty much similar to what exclusion does, but with one slight difference - user should not be aware of that dependency at all and, thus, won't have to use this exclusion explicitly.

如果这是不可能的(最有可能是真的),那么有什么特别的原因吗?

And if this is not possible (which, most likely, is true), then is there any particular reason why?

推荐答案

可选的依赖声音喜欢你想要的将依赖关系标记为可选,您将在构建时拥有它,但用户不会自动将该库作为传递依赖关系。

Optional dependencies sound like what you want. Mark a dependency as optional and you'll have it when you build, but users won't automatically have that library included as a transitive dependency.

请参阅 Maven - 可选依赖关系和依赖关系排除详细信息。

'提供'不是这里的理想解决方案;这意味着需要依赖 ,但是它将由您的工件的任何用户提供。 '可选'意味着依赖关系仅对某些功能才需要。

'provided' is not the ideal solution here; that means that a dependency is required, but that it will be provided by any user of your artifact. 'optional' means that the dependency is only required for some functionality.

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

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