Builds are Complicated: Java

about | archive

[ 2012-December-13 11:02 ]

An article titled Falsehoods programmers believe about build systems recently made the rounds on the Internet (additional comments on Reddit). As I've written about before, I think build systems are could be better, so this list of "incorrect" assumptions that build systems make is pretty interesting. One thing that this list neglects is that these assumptions are not mistakes for some companies, projects, or languages. I think this is why there are so many build systems: its easy to write for a small number of projects because you can make a bunch of simplifying assumptions. Then as the system is used for more projects, it inevitably needs more complexity. This is why I like Ninja: I think its minimal focus on only describing rules to transform input files into output files is large enough to be useful, but small enough to still be simple.

However, even Ninja makes assumptions that are violated by some languages, such as Java. Here are a bunch of ways that the way Java is "compiled" is unusual, and tends to break build tools like Ninja.

These are the reasons that many Java build systems have broken incremental builds. For example, it is basically impossible to do correct incremental builds with ant, at least the last time I checked. Thankfully Java compiles are usually fast enough that full rebuilds are acceptable.