Building with ant outside of NetBeans

Hi everyone,

A few others from uni and myself are starting up a game development project. We are using GitHub for sharing code and assets. I want to use a Jenkins Continuous Integration server to automate builds when one pushes (for testers to download the latest build etc). But I’m running into difficulty getting [bash]ant[/bash] to play ball in the command line.

I pushed a newly created project (from jMonkey IDE) to github, cloned it on a server and ran [bash]ant build[/bash]. The issue is with getting ant to accept a path where the jMonkey engine classes are stored. At first i tried exporting the $CLASSPATH environment variable which it didn’t recognize at compile time. I then tried using the comand [bash]ant -lib path/of/jme3zip/lib/.jar files [/bash]

I suspect the problems lies in the netbeans generated build-impl.xml file.

Just check the box to store the libraries in the project directory

Hi normen, I’m not really sure where you mean that. I have a quick look in the project properties settings in the IDE. I don’t want to store the jme libraries needed for compiling in the git repository. Surely there must be a way to ‘link’ the jars folder.

I want the build to work without netbeans.

My generalized process;

wget[what ever version].zip
#there is now a lib folder with all the jme jars needed for compiling right?
eventbus.jar jME3-blender.jar jME3-jogg.jar jME3-plugins.jar j-ogg-vorbisd.jar nifty.jar
gluegen-rt.jar jME3-core.jar jME3-lwjgl.jar jME3-terrain.jar jogl-all.jar nifty-style-black.jar
jbullet.jar jME3-desktop.jar jME3-lwjgl-natives.jar jME3-testdata.jar lwjgl.jar stack-alloc.jar
jglfont-core.jar jME3-effects.jar jME3-networking.jar joal.jar nifty-default-controls.jar vecmath.jar
jinput.jar jME3-jbullet.jar jME3-niftygui.jar j-ogg-oggd.jar nifty-examples.jar xmlpull-xpp3.jar

#now cd into local game repo where build.xml is #this is my problem
ant -lib /path/to/above/lib/folder/with/jars

#archive the dist folder for game testers to download [jenkins will do this]

Edit: sorry for the wacky html tags included. I think the code editor did it.

I’ve also tried ant -Dlibs.jme3.classpath=/path/to/jme/lib/jars

Then just set the references for the build script. You can see the names in the build script. Like libs.jme3.classpath etc.:

That works, if it doesn’t for you you do something wrong.

1 Like

Thanks a lot! I finally got it to build. What I did wrong was delete the nbproject/private folder which had a value pointing to that file you linked in my personal jmonkey installation (which wouldn’t have worked anyway).

What I’ve done is copy the into the repo, and supplied the command:
[bash]ant -Dlibs.jme3.dir=/home/tim/src/jmenighlyunzipped/lib[/bash]

This makes it work and eliminates the need for the nbproject/private folder [which i’m pretty sure shouldn’t be published] from being in the repo.

So hopefully I can get this working inside jenkins with the GitHub plugin.

That is about the same setup I have (I built jME from source but same result). The does the trick.
The next hurdle is when you want to use a module/plugin (like tonegodgui or whatever). Never did get that to work right but in theory there is an ant way to update the modules after unpacking the platform. My tip is to also look at the netbeans documentation, they have some hints on building from the command line and updating modules and such.