How To Develop JBoss with Eclipse
Short version
Download eclipse
Start eclipse in an empty workspace
Update eclipse to reasonable settings (including source code formatting)
Use the eclipse project set to get the JBoss Source
Build JBoss (generating parser source etc.)
Refresh the eclipse workspace to pickup the generated source
Download eclipse
Download eclipse http://www.eclipse.org/downloads/index.php. You'll need 3.1 if you want to develop against JBoss5 which has JSE5 source.
Unpack eclipse into a known location.
Start eclipse
I use a shell script that lets me go to any empty directory (or existing location) to define the "workspace". Obviously you need to change the locations of the jdk and eclipse.
#!/bin/sh export JAVA_HOME=/home/adrian/downloads/jdk1.5.0_03 export PATH=$PATH:$JAVA_HOME/bin /home/adrian/downloads/eclipse/eclipse -data ${PWD}/workspace -vmargs -Xmx128m &
Update eclipse to have have reasonable settings
Attached is an eclipse configuration file. In eclipse 3.1 do file/import/preferences/
to load this. I've also attach the formatting and code templates that I use (though these should be updated by the whole preferences).
preferences.epf - the preferences
codetemplates.xml - outline code
jboss-format.xml - the formatting file
NOTE: You'll want to change the code templates so it doesn't say an author of me.
Other things I personally haven't figured out how to get working.
Disable ant editing (it seems broken and slow to me?)
Change things like .dtd and .html to use the eclipse text editor rather than your web browser
Some file extensions are missing from the cvs config (which assumes binary by default) like .dtd
Some projects don't have a .cvsignore so add "output" to global list of "Ignored Resources"
Download the eclipse project set
Get the eclipse project set for the branch/tag you want to work with from eclipse.psf
If you want to ues the anonymous CVS access (because you have no write access) mangle the psf-file: sed 's/:extssh:cvs/:pserver:anonymous@anoncvs/g' eclipse.psf > eclipse-anon.psf
Use file/import/Team Project Set to get the projects/modules from cvs
Build JBoss and refresh
Since not all source comes from cvs (including thirdparty in jboss4 now), you need to build
jboss normally (including the testsuite). Once this is done refresh all projects.
NOTE: In JBoss4, you will also need to create a thirdparty project, file/new/project/simple/project
WARNING
If you haven't changed the preferences to ignore things like unused imports, etc. (there are over 4000 identified by the eclipse compiler), please try to resist the temptation to fix them. Everybody who uses eclipse for the first time wants to do this.
Eclipse has a powerful refactoring tool. Please avoid the temptation to get lost in refactoring hell.
Hot Code Swapping
In order for hot code swapping to work properly, the jboss build system and eclipse need to use the same compiler.
Switch the build system compiler to the eclipse compiler. The comments in build/local.properties explain how to do this.
For more tips, see CustomizingEclipse
WARNING
The current project set only works with Eclipse 3.1. Eclipes 3.2 MX is not compatible at this time.
Referenced by:
Comments