Builder

A Java build tool similar to Apache Ant, Apache Maven and Make.

E-Mail GitHub Javadocs LGPL-3.0

Summary

Builder is a Java build tool similar to Apache Ant, Apache Maven and Make.

Because no dependency management has been added to Builder so far, it is more similar to Apache Ant than to Apache Maven.

The main difference between Builder and Apache Ant though, is how you write your scripts. Apache Ant uses XML-files, whereas Builder uses Java source code. This is a lot more flexible, as you have the entire Java ecosystem at your disposal.

Even though Builder is a build tool, you can use it for other tasks as well. One such task could be to launch your program.

Features

You write your scripts with pure Java source code.
Built-in methods can zip, unzip, compile with javac, copy files and more.
You can use it for more than building projects, such as launching them.
Javadocs for the built-in methods exist.

Getting started

Currently a distribution is provided in the GitHub-repository (the dist directory) but no release has been made. You can use the distribution, or you can build the project yourself using Apache Ant.

If you downloaded the distribution, you may have to add the bin directory in the distribution to your environment variables under path. This is if you're running Windows. If you're running any other operating system, you will have to write your own launch files at this time, and put them in the bin directory.

To use Builder, navigate to a directory of your choice and create the file Build.java. Then write some Java source code. The code System.out.println("Hello, World!"); will do for now. Then open a terminal in your chosen directory and type builder and your code should be compiled and executed.

The above was just the default behaviour for Builder. To execute the file Clean.java, simply write builder Clean. You can also specify more than one file to execute. Then do something like builder Clean Build.

The following is an example using some of the built-in methods. Namely how to compile with javac.

empty("bin");
mkdirs("bin/main/java");
mkdirs("src/main/java");
javac("bin/main/java", null, null, getFilesFromDirectory("src/main/java"));

Dependencies

Java 8 + tools.jar The Java 8 runtime with tools.jar included.