Building vs. Compiling (Java)

sixtyfootersdude picture sixtyfootersdude · Apr 16, 2010 · Viewed 91k times · Source

Thinking that the answer to this is pretty obvious but here it goes:

When I am working on a small project for school (in java) I compile it.

On my coop we are using ant to build our project.

I think that compiling is a subset of building. Is this correct? What is the difference between building and compiling?

Related:
What is the difference between compiling and building?

Answer

Pascal Thivent picture Pascal Thivent · Apr 16, 2010

The "Build" is a process that covers all the steps required to create a "deliverable" of your software. In the Java world, this typically includes:

  1. Generating sources (sometimes).
  2. Compiling sources.
  3. Compiling test sources.
  4. Executing tests (unit tests, integration tests, etc).
  5. Packaging (into jar, war, ejb-jar, ear).
  6. Running health checks (static analyzers like Checkstyle, Findbugs, PMD, test coverage, etc).
  7. Generating reports.

So as you can see, compiling is only a (small) part of the build (and the best practice is to fully automate all the steps with tools like Maven or Ant and to run the build continuously which is known as Continuous Integration).