Why is no one using make for Java?

前端 未结 17 1507
生来不讨喜
生来不讨喜 2020-12-12 09:09

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

17条回答
  •  长情又很酷
    2020-12-12 09:57

    The venerable make program handles separately compiled languages like C and C++ reasonably well. You compile a module, it uses #include to pull in the text of other include files, and writes a single object file as output. The compiler is very much a one-at-a-time system, with a separate linking step to bind the object files into an executable binary.

    However, in Java, the compiler has to actually compile other classes that you import with import. Although it would be possible to write something that generated all the necessary dependencies from Java source code, so that make would build classes in the correct order one at a time, this still wouldn't handle cases such as circular dependencies.

    The Java compiler can also be more efficient by caching the compiled results of other classes while compiling further classes that depend on the results of ones already compiled. This sort of automatic dependency evaluation is not really possible with make alone.

提交回复
热议问题