0

This is in regards to building a Java Project.

So I'm a bit confused on my options here.

My requirements (it's a small project):

  • Needs to compile Java project with specific/custom compiler arguments

  • Project has native libs that need to be included

  • need to compile javascript->java class via Rhino javascript compiler (https://developer.mozilla.org/en/Rhino/JavaScript_Compiler)

  • After the build I need to run another command: ProGuard (http://proguard.sourceforge.net/)

  • run javadocs

  • Package everything up in Jar (also including external data, ie, images, xml, ini, etc)

  • Build/create a .jnlp web start.

  • Available under both Win and Linux would be optimal.

  • this is a hobby project, so don't want to spend weeks learning/managing the build system. At most an 8-12 hour investment start to finish (otherwise it's just better to keep doing everything by hand).

  • btw, my IDE is Eclipse if it matters; a nice integrated plugin would be nice - but not required.

So far I think Ant and Maven are the main two build systems in use. It's very unclear to me though which one I should use or how they differ?

The other option would be 'make' under linux (or maybe cygwin). I've only used it once, but seemed pretty quick to get going/working. Is that a good option for Java or this project? Any downsides to make? Why don't more java developer's use it?

Other options?

user697111
  • 2,232
  • 8
  • 29
  • 40
  • I don't get the problem with your running of proguard. All you do is create the jar and do what it says on the website! – nmagerko Nov 11 '11 at 00:57
  • i vote for maven, it has plugins for rhino, proguard, javadoc, etc. You can do everything you just said with maven. – gigadot Nov 11 '11 at 01:21
  • `make` is not well suited to Java builds, but `ant` targets can be convenient `make` commands. – trashgod Nov 11 '11 at 01:58
  • I'm not having a problem with proguard. I just want to make sure any build system I use will be able to automated it. – user697111 Nov 11 '11 at 02:25
  • What problems are there will 'make' for java builds? I don't know much about make, but seems like it could be used good enough? – user697111 Nov 11 '11 at 02:26

2 Answers2

3

In a nutshell: spend your 12 hours learning and using Ant.

Maven has a good feel out-of-the box, super-easy to get going and with the neat dependency management, but down the line tweaking the pom.xml (your project's maven build file) to fit your needs will require more fiddling with than if you used Ant.

To address some of your specific requirements:

  • you can use <compilerarg> elements with the <javac> task
  • for native libs you can add them with: <sysproperty> and key="java.library.path"
  • use Rhino with Ant (http://stackoverflow.com/questions/3526960/using-recent-rhino-in-ant-script)
  • there is a Proguard task for Ant (http://proguard.sourceforge.net/index.html#/manual/ant.html)
  • for javadoc Ant comes with the <javadoc> task out of the box
  • the <jar> Ant task is extremely easy to use to package everything up
  • there is a <jw:jnlpwar> task available from the [Ant Web Start Task project] at (http://ant-jnlp-war.sourceforge.net)
  • Ant is ubiquitous, it works for just about every major platform out there (Linux, Unix, Windows, MacOS)
  • with plenty of docs and examples available on the web, you'll pick-up Ant in no time, and those hours you'll spend learning it will probably "pay" themselves back within a couple of weeks of using it for your builds.
  • Eclipse integrates with Ant out of the box (http://help.eclipse.org/indigo/index.jsp?topic=/org.eclipse.platform.doc.user/gettingStarted/qs-81_basics.htm)

It may not do fancy dependency management out-of-the-box like Maven (although for that you can integrate Ant with Ivy) but it certainly provides you with all the flexibility you'll ever need, and you won't find yourself "fighting" the build tool configuration file as it's fairly common with Maven.

I should probably just mention the 2 new names in Java build (and CI) tools: Hudson and Jenkins. They're fairly recent and may be interesting to look at, but I would definitely not recommend them to you and your project at this early stage.

Note: apologies for the lack of real links (only allowed 2 links atm)

ktorn
  • 88
  • 7
0

Maven is the best choice here as it has integration for all of these

so go for it.

Here, quick links for you to save an extra hour to spend on learning maven ;)

Community
  • 1
  • 1
Prashant Bhate
  • 10,907
  • 7
  • 47
  • 82