A Java build tool that works seamlessly with modules
No need to be a maven to be able to use a build tool
With the introduction of modules in Java 9, creating modules/jars is easier and new applications will tend to have many more, smaller modules than before. The build model of Maven is not well suited to describe this new world.
- programmatic API first
- use convention over configuration
- stateless plugins
- separate configuration time where configuration is mutable and build time where configuration is immutable
- external dependencies are in plain sight (in the
anatomy of a build.pro
pro uses a file named
build.pro as build script, which is composed of two parts, the configuration part and the run part.
In the configuration part, you can set the properties of a specific plugin, by example, this how to set the release version of the source to Java 11 for the compiler
you can chain the calls, by example to set the source release and use the preview features
compiler. sourceRelease(11). enablePreview(true)
Note: pro uses jshell to parse the build.pro, this tool is line oriented so you have to put the dot '.' at the end of the line to ask for the parsing of the next line.
Then you have to call
run() with all the commands you want to execute, by example,
to run the
compiler on the sources and uses the
packager to create a jar.
Here is a list of the main plugins
resolveruse Maven artifact coordinates to download the dependencies
modulefixerpatch the artifacts downloaded to make them fully compatible with the module-path
compilercompile the sources and the tests
testerrun the JUnit 5 tests
docergenerate the javadoc
main()of the main class of the main module.
To create the layout of a minimal project, you can use the option
mkdir myproject cd myproject pro scaffold
scaffold will ask for a module name (a name in reverse DNS form like a kind of root package) and will generate a skeleton of the folders.
Then you can run pro to build your project
There is a small demo in the github project pro-demo.
To compile and build pro, run:
pro will bootstrap itself.
To build pro you need the jdk11 or a more recent version, you may have to change the value of the variable JAVA_HOME at the start of the script build.sh.
Once built, you have an image of the tool in target/pro. This image embeds its own small JDK: no need to install anything Java-related to be able to build your application. Obviously, you will need a JDK to run your application.