简体   繁体   English

是否有一个简单的项目构建/依赖管理工具用于Java项目?

[英]Is there a simple project build/dependency management tool for Java projects?

I've been using Maven and ant+ivy so far but I think it is rather hard to maintain all the configuration for them. 到目前为止,我一直在使用Maven和ant + ivy,但我认为维护它们的所有配置相当困难。

What I'd really like to have is something like leiningen which does not need any xml and you can manage the dependencies in code (in clojure code in case of leiningen). 我真正喜欢的是像leiningen这样的东西,它不需要任何xml,你可以管理代码中的依赖项(在leiningen的情况下使用clojure代码)。 It also comes with a handy cli tool. 它还配有一个方便的cli工具。

I know that leiningen uses maven internally so it is not a problem if your suggestion uses maven internally as well so a good abstraction which simplifies things and requires no interaction with maven/ant/ivy will be equally good for me. 我知道leiningen在内部使用maven所以如果你的建议在内部使用maven也不是问题,所以一个简单的抽象,简化事情并且不需要与maven / ant / ivy的交互对我来说同样有益。

I would use pure maven or gradle, as it is easier to create build scripts, but would steer away from ant. 我会使用纯maven或gradle,因为它更容易创建构建脚本,但会远离ant。

Ivy is an underused dependency management solution, and I personally have only cursory experience (as in building artifacts but not managing them) and I have never maintained an ivy build, but seems pretty straightforward. Ivy是一个未充分利用的依赖管理解决方案,我个人只有粗略的经验(如构建工件但不管理它们),我从未维护过常春藤构建,但看起来非常简单。 One thing to consider is availability of plugins and readily built artifacts(which is proportional to popularity) and maven is the clear leader. 需要考虑的一件事是插件的可用性和易于构建的工件(与流行度成正比),而maven是明显的领导者。

So, my recommendation would be pure maven or gradle. 所以,我的建议是纯粹的maven或gradle。

Edit: In recent years it has become modern for some repo owners to maintain both an ivy and a maven build to increase their code's exposure. 编辑:近年来,一些回购所有者保持常春藤和maven构建,以增加他们的代码曝光已成为现代。 If you were to do that, gradle would be simpler as it provides a nice abstraction on top of the nitty gritty maven/ivy stuff, once you are to write your scripts. 如果你这样做的话,gradle会更简单,因为它一旦你要编写你的脚本,它就会提供一个很好的抽象,而不是基本的maven / ivy东西。

I would suggest gradle. 我建议gradle。 Gradle is both a dependency management and build system. Gradle既是依赖管理又是构建系统。 You write your build scripts in groovy code, no xml. 你用groovy代码编写你的构建脚本,没有xml。 gradle can work with existing ivy or maven repos. gradle可以使用现有的常春藤或maven回购。 Its configuration tends to be a lot less verbose than maven's and it's very flexible (since you can write code in your build script when needed). 它的配置往往比maven更简洁,而且非常灵活(因为你可以在需要的时候在你的构建脚本中编写代码)。

There is plenty of documentation at http://www.gradle.org/documentation http://www.gradle.org/documentation上有大量文档

There used to be a project called Polyglot Maven which was maven configured in code not xml. 曾经有一个名为Polyglot Maven的项目,它是用代码而不是xml配置的maven。 Some detail is given about its current status here: What happened to Maven Polyglot? 关于它目前的状态给出了一些细节: Maven Polyglot发生了什么?

I also found Buildr (for building Java projects, with config written in Ruby). 我还发现了Buildr (用于构建Java项目,使用Ruby编写的配置)。

I think it'd be worth clarifying why it is you find the configuration for maven difficult to maintain. 我认为值得澄清的是,为什么你发现maven的配置难以维护。 Certainly the XML can be pretty nasty but there's lots of tooling available in IDEs etc. If its the actual project structure and or build lifecycle that's difficult (and it can be, especially with multimodule builds) then a solution that's based on maven probably won't be much better. 当然,XML可能非常糟糕,但IDE中有很多可用的工具。如果它的实际项目结构和/或构建生命周期很难(并且可能,特别是对于多模块构建)那么基于maven的解决方案可能会赢得'好多了。

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

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