Java轻量级构建工具

发布于 2024-08-22 04:12:32 字数 52 浏览 4 评论 0原文

我正在寻找一个轻量级的 Java 构建工具。尽可能轻。即使以牺牲功能为代价。有什么建议吗?

I am looking for an lightweight Java build tool. As light as possible. Even at the expense of features. Any recommendations?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

╰◇生如夏花灿烂 2024-08-29 04:12:32

尽可能轻?那必须是从批处理文件或 shell 脚本中运行的 javac。

但为什么?

As light as possible? That must be javac running from within a batch file or shell script.

But why?

栖迟 2024-08-29 04:12:32

实际上只有两个选择:Ant 或 Maven。

Ant 本质上是一个脚本工具,您可以用它做任何事情,但您必须自己编写所有内容。

Maven 附带了许多预定义的项目类型。它会向你规定一个目录结构(有些人不喜欢),但也会处理依赖关系(Ant 可以用 Ivy 来做到这一点)。

我个人更喜欢Maven。几行 XML 即可让您执行运行单元测试、停止和启动 Web 容器(例如 Jetty 或 Tomcat)等任务。

There are only really two choices: Ant or Maven.

Ant is essentially a scripting tool that you can do anything with but you have to write everything yourself.

Maven comes with a lot of predefined project types. It will dictate a directory structure to you (which some people don't like) but will also handle dependencies (which Ant can sorta do with Ivy).

Personally I prefer Maven. A few lines of XML will get you the tasks to run unit tests, stop and start a Web container (eg Jetty or Tomcat), etc.

情独悲 2024-08-29 04:12:32

正如其他地方所说,您真正的选择是在 Maven 或 ant 之间。为了呼应其他观点,我发现 ant 有更多的配置,所以我更喜欢 Maven。也就是说,很多人倾向于批评maven,因为尽管你需要的配置较少,但它下载了很多依赖项(以及依赖项/依赖项),所以这完全取决于你所说的“轻”是什么意思 - 你的意思是轻在配置或依赖jar下载/安装大小?

如果您想要简单的配置下载,那么最好使用 shell 脚本,但只有您有时间才能实现功能丰富!

As said elsewhere, your real choice is between maven or ant. To echo other sentiments, I find there is more configuration to do with ant, so I prefer maven. That said, a lot of people tend to criticise maven in that although you need less configuration, it downloads a lot of dependencies (and dependencies/ dependencies), so it all depends on what you mean by "light" - do you mean light in configuration or light in dependency jar downloads/installation size?

If you want something light in terms of config and downloads, you are better off with a shell script, but that will only be as feature-rich as you have time to make it!

看春风乍起 2024-08-29 04:12:32

我再次推荐 Maven2 - 通过使用插件,它的功能非常丰富,但它也可以非常“轻”(取决于这意味着什么):

  • 它不需要硬安装(只需解压缩目录+将其路径添加到环境变量中(取决于操作系统))
  • 它不需要配置 - 只需复制粘贴一个简单的 POM 文件,您的构建就准备好了。您只需遵循 maven 的目录结构约定,
  • 它为每个 IDE 都有一个插件,因此将它与 GUI 一起使用会更加容易。

当然,另一种选择是 ant,但我发现它不太“轻”。 发现它不那么轻松,因为 ant 脚本变得丑陋且不可预测,并且变得难以管理,而 Maven 脚本则保持简单,因为该工具提供了丰富的功能。

I'd again recommend Maven2 - it is very feature rich through the use of plugins, but it can also be very "light" (depending on what that means):

  • it doesn't need hard installation (just unzip directory + add the path to it to the environment variables (depending on OS))
  • it doesn't require configuration - just copy-paste a simple POM file and your build is ready. You will just have to follow the directory structure conventions of maven
  • it has a plugin for every IDE, so using it with GUI makes it even easier.

Of course, an alternative is ant, but I find it less "light". And I find it less light, because ant scripts grow ugly and unpredictable, and become hard to manage, while maven scripts stay simple, because of the rich functionality provided with the tool.

烟沫凡尘 2024-08-29 04:12:32

这实际上取决于您对“光”的定义。您是否想要一个只需很少工作即可使用的工具(只需少量代码)?如果是这样,MavenGradle 可能是一个不错的选择。 Maven 已经存在有一段时间了。如果您正在做一些遵循其约定的事情,那么您将需要在 pom.xml 文件中编写很少的内容。如果你开始偏离规范,就很难让它满足你的需要(让事情变得不那么轻松)。 Gradle 也是一个选择。它的存在时间不如 Maven,但可以让您更轻松地偏离约定。

如果您正在寻找工具本身轻量级的东西,Apache ant 可能是更好的选择选项。它没有像 Maven 那样内置约定。如果您有一个非常简单的非标准构建,则可以创建一个非常轻量级的 Ant 脚本来完成您的构建。

It really depends on your definition of 'light'. Do you want a tool that requires very little work to use (light on code)? If so, Maven or Gradle might be a good option. Maven has been around for a while. If you are doing something that follows their conventions, then you will need to write very little in your pom.xml files. If you start deviating from the norm it can get difficult to make it do what you need (making things less light). Gradle is also an option. It hasn't be around as long as Maven, but allows you to deviate from the convention easier.

If you are looking for something that is light in terms of the tools itself being lightweight, Apache ant may be a better option. It doesn't have the conventions built in like Maven. If you have a non-standard build that is pretty simple it might be possible to create a very light ant script to do your build.

我为君王 2024-08-29 04:12:32

如果您遵循 Maven 的目录结构,它是最简单的。如果你在linux或unix系统上,我会使用shell脚本。或者您可以考虑 IDE eclipse 或 netbeans,它们会为您完成这项工作,并且依赖项非常容易配置。

Maven is simplest if you follow its directory structure. If you are on linux or unix system, I would use shell script. Or you could consider IDEs eclipse or netbeans, they will do the job for you, and dependencies are very easy to configure.

最冷一天 2024-08-29 04:12:32

您尝试过 BlueJ (http://www.bluej.org/) 吗?几年前我用它来教学生。从某种意义上说,它很简单,您只需复制/粘贴代码并运行它即可。它是为了教授学生而创建的,因此非常简单并且适合 Java 初学者。请注意,它是一个完整的 IDE,而不是像 maven 或 ant 这样的命令行工具。

Have you tried BlueJ (http://www.bluej.org/) ?. I used it a few years ago to teach students. It is simple in the sense you can just copy/paste code and run it. It was created to teach students, hence is very simple and good for java starters. Note that it is is a full IDE, not a command line tool like maven or ant.

子栖 2024-08-29 04:12:32

如果您要坚持标准,Maven 是最好的选择。
如果您想要灵活性,请考虑 Groovy AntBuilder。简洁的语法,以及 ant 和 groovy 脚本的全部功能。

If you are going to stick with standards, Maven is the best bet.
If you want flexibility consider Groovy AntBuilder. terse syntax, and full power of ant and groovy scripting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文