Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java build system options

Tags:

java

git

build

I'm currently building a desktop java application in a very clumsy manner. The application is deployed on Windows, Mac and Linux. Here's my build process now:

On Windows:

  • Update local repository
  • Fire up Eclipse
  • Refresh the project
  • Double click the .jardesc file to generate an executable jar file
  • Commit the executable jar to source control
  • Open up the .nsi script and click the build button (I have NSSI plugin installed) to produce the .exe installer
  • Upload installer to ftp server to publish

On Mac:

  • Update local repository
  • Run shell script to generate .dmg file using .jar in source control
  • Upload to ftp server to publish

On Linux:

  • Update local repository
  • Run shell script to generate .deb file using .jar in source control
  • Upload to ftp server to publish

I'd also like to include some extra steps in my build in the future, such as:

  • Setting build date
  • Setting the HEAD git commit-id
  • Performing some code obfuscation

Any suggestions on how I can streamline and speed up this process?

like image 266
CodeBuddy Avatar asked Oct 27 '25 14:10

CodeBuddy


2 Answers

If you are serious about having a good build system, then I'd recommend learning and using Maven, which provides:

  • Comprehensive project build lifecycle management based on a declarative project definition (pom.xml)
  • A huge range of plugins, which I expect will be able to handle all the specific build steps you require
  • Very good integration with Eclipse
  • Full dependency management (including automatic resolution and download of dependencies)

This is not for the faint hearted (Maven is a complex beast) but in the long run it is a great solution.

like image 62
mikera Avatar answered Oct 29 '25 04:10

mikera


First step would be to just get everything building without Eclipse.

You might also want to consider using something like Jenkins to automate some of this. You'll still require build scripts.

A solution could look like

  1. Update repository.
  2. Jenkins detects update and builds the jar.
  3. Jenkins saves the jar to some location.

Then you can have separate builds for each OS, also running in Jenkins. These could be triggered automatically on successful completion of the first build. These would each:

  1. Pick up the jar from the previous build.
  2. Publish the OS specific binary to an FTP site.

Ant is a good start, but you may also want to look at Apache Ivy or Maven, as these will help a bit with managing your build outputs and dependencies.

like image 31
Eric Avatar answered Oct 29 '25 02:10

Eric



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!