GlassFish Developer InstructionFor complete build instructions, please see: FullBuildInstructions. First, make sure your maven can find artifacts from the java.net maven2 repository. <settings> <!-- only if you are behind the proxy --> <proxies> <proxy> <active>true</active> <protocol>http</protocol> <host>proxy.somewhere.com</host> <port>8080</port> </proxy> </proxies> </settings> If you're building in Oracle Network, set the proxy host and port as: <host>www-proxy.us.oracle.com</host> <port>80</port> Next, check out the part of the glassfish that you are interested in working on. For example, svn checkout https://svn.java.net/svn/glassfish-svn/trunk/main/appserver/web/appserv-webtier 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. mvn -DdownloadSources=true eclipse:eclipse // for Eclipse After you make your changes, you can build your module by running the following command. mvn install Once you are satisfied with your change, use svn to commit the changes. Edit/Build/Debug CycleYou'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: mvn gf:run 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: UNIX: export MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5050 Windows: setlocal set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5050 mvn gf:run endlocal 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. Further ReadingRead more about how GFv3 build/development works to get a better understanding why this works. Also, see this jenblog entry for more build tips. Other Productivity Tips
|