For complete build instructions, please see: FullBuildInstructions.
First, make sure your maven can find artifacts from the java.net maven2 repository.
This is done by making sure that your ~/.m2/settings.xml has a proper entry like this:
If you're building in Oracle Network, set the proxy host and port as:
Next, check out the part of the glassfish that you are interested in working on. For example,
if you are working on appserv-webtier, you'd do the following.
You can then generate project files for your IDE by running the command like below. Due to the directory layout, this does not work for some of the modules. NetBeans and Intellij don't need such additional step as it can understand Maven natively by using a plugin.
After you make your changes, you can build your module by running the following command.
Once you are satisfied with your change, use svn to commit the changes.
You'll be spending most of time going through edit/build/debug cycle, so making this step efficient is important for your productivity.
After you make changes, you can launch Glassfish with your local changes by running the following command:
This starts Glassfish with your module's target/classes and all the other pre-built binaries. The first time around it will take some time to download all those additional binaries, but from then on this should run fairly quickly.
To launch this Glassfish under the debugger, do as follows. You'll be running this often, so it's usually a good idea to make this a little shell script or an alias:
The same technique is also used if you need to tweak the VM launch parameter. See the plugin documentation for more about gf:run goal and how to customize its behavior.
Once Maven starts under debugger, connect your IDE remotely to the port, and you can debug it all you like. Also, be sure to learn about hot swapping, so that you can make simple changes from your IDE without restarting Glassfish.
- For building your module, Maven occasionally needs to hit the remote repository to check if any of your dependencies are updated. You can avoid this by running mvn with the -o option. This often reduces the build time.
- Contrarily, if you want to force Maven to check updates to all your dependencies, run mvn with -U -up. This is often necessary when a change in your code depends on another change another developer made in another module.
- Sun employees can use the internal maven repository mirrors for faster repository access.
- Automate deployment via Hudson.