For a demo at a developer event next week spent some time on figuring out how to build Glassfish. Glassfish is the next version of Suns J2EE application server and it has been open sourced at JavaOne this year. I did not find a complete how-to right away, but after some searching it came down to some simple steps:
A couple of prerequisites:
- JDK1.5 (set JAVA_HOME and have $JAVA_HOME/bin in PATH)
- Maven 1.02 (set MAVEN_HOME and have $MAVEN_HOME/bin in PATH)
Now start building it:
- First you need to make sure that you have a network connection to the CVS server at java.net. At home that's no problem, but at the office I had to set up a tunnel through a socks proxy using
ssh -x -2 -g -L 2401:localhost:2401 firstname.lastname@example.orgThe password is tunnel
- Once you're connected, log in to CVS at java.net:
cvs -d :pserver:guest@localhost:/cvs login(password empty)
- And get the main module:
cvs -d :pserver:email@example.com:/cvs checkout glassfish/glassfishIf you set up a tunnel in the first step you should replace cvs.dev.java.net with localhost like this:
cvs -d :pserver:guest@localhost:/cvs checkout glassfish/glassfish
Now cd to the glassfish directory and edit the project.properties file. In my case I had to adjust the following properties:
glassfish.os.name glassfish.cvs.username glassfish.root maven.proxy.host maven.proxy.port
Now you're all set up to get the rest of the code. Do a
maven checkoutand sit back for a while... this is going to take ~30 minutes or so and will give the all the code that is part of Glassfish.
In order to build it you need two extra steps:
maven bootstrap maven buildThe bootstrap step completes fairly quick, the build step is taking up to an hour, so sit back and catch up with some reading.
Now the appserver is build and using a
maven configure-runtimeThe runtime environment will be configured. After this goto the
../publish/glassfish/bindirectory and do a
./asadmin start-domain domain1to start the freshly build application server.
- You should now be able to acces the admin console on http://localhost:4848 (log in as admin/adminadmin) and the webpages at http://localhost:8080. (You can changes these ports in the project.properties file if you want.)