Retrobuild — Java Build and Export System

DZone 's Guide to

Retrobuild — Java Build and Export System

Build system can create a lot of problems. Here's a look at Java Export and Build systems.

· Java Zone ·
Free Resource

Build system is one of the biggest troubles I have seen in various companies, both the ones I worked for and the one I consulted. The build process was always complicated (that only few people in the company knew) and requires tricks (tabs, new lines…).

I have built ClassyShark with the IntelliJ’s built-in option of exporting artifacts. As ClassyShark became bigger and complicated, the build artifacts process became more annoying. It was twiddling around checkboxes and options in UI, and making sure that each new dependency (jar) made its way to the release jar. Actually twiddling around the UI was just the symptom. The real problem was that I wasn’t in control on my build process, kind of living under IDE mercy. This made me really uncomfortable (think something changes in IDE etc’).

So I needed something better; build system! I looked at the following:

  • gradle
  • ant
  • maven
  • make
  • scons

But I didn’t find them suitable for ClassyShark. Mostly due to the reasons of having build systems become more complicated than the project it builds, major changes to ClassyShark structure, adding and maintaining build scripts in various languages and formats.

So I wrote my own: Retrobuild, small, simple, and fast build and export jar system.

All in all, I needed four things:

  1. Make release folder
  2. Compile sources in release folder
  3. Copy dependency jars and extract their classes in the same release folder
  4. Create jar from classes in steps 2 and 3

And Retrobuild does them all written in written in a pure Java, debuggable, platform independent, rich ecosystem, familiar APIs. No need to look at XMLs, to wrest with complicated system, useful for my next projects and no ClassyShark code changes.

Feel free to use it as well, pretty simple, create your Config class overriding methods defined here. Here is the simple main. Call the following code:

RetroBuild.with(new MyBuildConfig()).build();

And build!

So far exporting ClassyShark with IntelliJ takes 2.7 seconds while with Retrobuild it takes 3 seconds. This is something I can live with.

build, java

Published at DZone with permission of Boris Farber , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}