Setting up Eclipse for debugging XWiki Enterprise
Version 91.1 by Thomas Mortagne on 2011/04/21 16:09
The goal of this tutorial is to describe a way to setup Eclipse to be able to :
- edit web files (javascript, images, ...) in and automatically publish them in a running instance of XWiki without restarting it
- edit and debug java without restarting XWiki instance
All these tricks helps to improve the programming speed a lot.
Prerequisites
- Knowledges:
- This tutorial does not explain how Eclipse/JDT works and how to install Eclipse plugins
- You should already know how to build XWiki using maven and also how maven generally works, how to create pom.xml, etc. You can look at Building XWiki.
- You should take a look at general XWiki sources repository structure.
- Tools
- Java JDK 1.5 or superior
- Apache Tomcat installed on your computer : http://tomcat.apache.org/
- Eclipse: You can download Eclipse from the Eclipse Download Site. Alternatively you can download one of the many Eclipse distributions, such as the "Eclipse IDE for Java EE Developers" one which includes other features and plugins such as the Web Tools Project.
- Maven Eclipse plugin: http://m2eclipse.sonatype.org/
- AJDT Eclipse plugin: http://www.eclipse.org/ajdt/. If you plan to debug XWiki Core or any other project which contains AspectJ files.
Get the source for XWiki
Clone platform repository (see http://dev.xwiki.org/xwiki/bin/view/Community/SourceRepository#HCheckingoutsources) somewhere in your computer different from your Eclipse workspace.
git clone [email protected]:xwiki/xwiki-platform.git
Setting Eclipse
To be able to launch XWiki into Eclipse and debug it we will create a WTP project which will be a mirror of the product web we want to work on. Here it will be XWiki Enterprise.
- Checkout xwiki-debug-eclipse project
The best way to get the debug project is to clone it from git and look at the README file instructions. - Import and link maven jar projects to debug
- Start XE Web Debug Project
- Troubleshoots
- Enjoy
Other useful tricks/tools
- To dynamically validate your java code on XWiki codestyle you should use and configure Eclipse Checkstyle plugin (Note that this is already installed and configured in Yoxos Eclipse distribution for XWiki).
- Look at DevelopmentTools for a list of usefull development tools.
- You can use XEclipse to edit wiki pages : XEclipseExtension.
TODO
- find a way to support new wysiwyg
- add more explanation on how "Run as server" works behind the scene
- http://code.google.com/p/m2eclipse-wtp-ext/ seems promising