为什么没有人使用 make for Java? [英] Why is no one using make for Java?

查看:31
本文介绍了为什么没有人使用 make for Java?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几乎我见过的每个 Java 项目都使用 Maven 或 Ant.它们是很好的工具,我认为几乎任何项目都可以使用它们.但是 make 发生了什么?它用于各种非 Java 项目,并且可以轻松处理 Java.当然,如果你使用 Windows,你必须下载 make.exe,但是 Ant 和 Maven 也不带有 JDK.

Just about every Java project that I've seen either uses Maven or Ant. They are fine tools and I think just about any project can use them. But what ever happened to make? It's used for a variety of non-Java projects and can easily handle Java. Sure you have to download make.exe if you use Windows, but Ant and Maven also don't come with the JDK.

与 Java 一起使用时,make 是否存在一些根本性缺陷?难道仅仅是因为Ant和Maven是用Java编写的吗?

Is there some fundamental flaw with make when used with Java? Is it just because Ant and Maven are written in Java?

推荐答案

Make 和 Java 的基本问题是 Make 工作的前提是您已指定依赖项,然后是解决该依赖项的规则.

The fundamental issue with Make and Java is that Make works on the premise that you have specify a dependency, and then a rule to resolve that dependency.

对于基本的 C,通常要将 main.c 文件转换为 main.o 文件,请运行cc main.c".

With basic C, that typically "to convert a main.c file to a main.o file, run "cc main.c".

你可以用 Java 做到这一点,但你很快就会学到东西.

You can do that in java, but you quickly learn something.

主要是 javac 编译器启动缓慢.

Mostly that the javac compiler is slow to start up.

两者的区别:

javac Main.java
javac This.java
javac That.java
javac Other.java

javac Main.java This.java That.java Other.java

是白天和黑夜.

用数百个类加剧这种情况,它就会变得站不住脚.

Exacerbate that with hundreds of classes, and it just becomes untenable.

然后,您将这一点与 Java 倾向于在目录中组织为文件组的事实相结合,而 C 和其他倾向于更扁平的结构.Make 对处理文件层次结构没有太多直接支持.

Then you combine that with the fact that java tends to be organized as groups of files in directories, vs C and others which tend towards a flatter structure. Make doesn't have much direct support to working with hierarchies of files.

Make 也不太擅长在集合级别确定哪些文件已过期.

Make also isn't very good at determining what files are out of date, at a collection level.

使用Ant,它会遍历并总结所有过时的文件,然后一次性编译它们.Make 将简单地在每个单独的文件上调用 java 编译器.让 make NOT 做到这一点需要足够的外部工具来真正表明 Make 不能胜任这项任务.

With Ant, it will go through and sum up all of the files that are out of date, and then compile them in one go. Make will simply call the java compiler on each individual file. Having make NOT do this requires enough external tooling to really show that Make is not quite up to the task.

这就是 Ant 和 Maven 等替代品兴起的原因.

That's why alternatives like Ant and Maven rose up.

这篇关于为什么没有人使用 make for Java?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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