编写一个依赖Groovy的库是一个好主意吗?(Is writing a library with a dependency on Groovy a good idea?)

编程入门 行业动态 更新时间:2024-10-24 04:41:40
编写一个依赖Groovy的库是一个好主意吗?(Is writing a library with a dependency on Groovy a good idea?)

我现在正在编写一个Java库,我将其作为Maven工件发布并在不同的Java / Groovy项目中使用。 我想知道一般来说编写一个依赖于某个版本的Groovy的库是个好主意(例如,依赖于groovy-all-2.xy )。 在库中使用Java的不舒服并不会太糟糕。

你怎么看? 我应该更好地使用Groovy依赖的宽大版本范围吗? 我应该写一个普通的Java库吗?

I am writing a Java library right now that I publish as a Maven artifact and use in a different Java/Groovy project. I was wondering whether in general it is a good idea to write a library that depends on a certain version of Groovy (e.g. has a dependency on groovy-all-2.x.y). The discomfort of just using Java in the library would not be too bad.

What do you think? Should I better use a generous version range for the Groovy dependency? Should I rather write a plain Java library?

最满意答案

我想这取决于你希望如何使用它。

如果它不是一个实用程序,你不认为其他项目会使用它,那么做你想做的任何事情。

如果它是一个设计用于测试的实用程序,我不认为对测试类路径的groovy依赖太糟糕了。 我确信有些项目仍会因为常规的依赖性而避免使用它们。

如果你希望人们在任何地方使用它是一个通用的实用工具,那么我会说一个groovy依赖肯定是一个坏主意。 我当然不会使用它,我相信很多人会因为同样的原因而避免使用它。

如果您希望最大程度地采用您的实用程序,请尽可能少地保留依赖项。 Groovy是一个巨大的,臃肿的依赖,很多项目都会避免。

I guess it depends on how you want it to be used.

If it's not a utility and you don't think other projects will use it, then do whatever you want.

If it's a utility designed to be used in testing, I don't think a groovy dependency on the test classpath is too bad. I'm sure some projects would still avoid your utility because of the groovy dependency.

If it's a general utility that you want people to use everywhere, then I'd say a groovy dependency is definately a bad idea. I certainly wouldn't use it and I'm sure many others would avoid for the same reason.

If you want maximum adoption of your utility, keep the dependencies as few as possible. Groovy is a huge, bloated dependency that many projects will avoid.

更多推荐

本文发布于:2023-08-04 15:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1417703.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:是一个   好主意   writing   Groovy   good

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!