Skip to content
/ pro Public

A Java build tool that works seamlessly with modules

License

Notifications You must be signed in to change notification settings

forax/pro

Repository files navigation

Linux build status Windows build status

pro

A Java build tool that works seamlessly with modules

No need to be a maven to be able to use a build tool

rationale

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.

principles

  • 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 deps folder)

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

  compiler.sourceRelease(11)

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,

  run(compiler, packager)

to run the compiler on the sources and uses the packager to create a jar.

Here is a list of the main plugins

  • resolver use Maven artifact coordinates to download the dependencies
  • modulefixer patch the artifacts downloaded to make them fully compatible with the module-path
  • compiler compile the sources and the tests
  • tester run the JUnit 5 tests
  • docer generate the javadoc
  • runner run the main() of the main class of the main module.

getting started

To create the layout of a minimal project, you can use the option scaffold

  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

  pro

demo

There is a small demo in the github project pro-demo.

build instructions

To compile and build pro, run:

build.sh

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.

About

A Java build tool that works seamlessly with modules

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages