Setting up Eclipse for debugging XWiki Enterprise

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 (this tutorial is based on 1.6)
    • Apache Tomcat installed on your computer (this tutorial is based on 5.5) : http://tomcat.apache.org/
    • Eclipse (this tutorial is based on Eclipse J2EE Europa/3.4)

Get the source for XWiki

Checkout platform trunks (see http://dev.xwiki.org/xwiki/bin/view/Community/SourceRepository#HCheckingoutsources) somewhere in your computer different from your Eclipse workspace.

svn co http://svn.xwiki.org/svnroot/xwiki/platform/trunks/ platform
Use https instead of http if you have committer rights

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.

  1. Create debug project
    1. Checkout the default project (Recommended)
      The best way to get the debug project is to checkout it from [http://svn.xwiki.org/svnroot/xwiki/platform/xwiki-tools/trunk/xem-web-debug-eclipse/].
      You can directly import the project using Eclipse SVN plugin with the url http://svn.xwiki.org/svnroot/xwiki/platform/xwiki-tools/trunk/xem-web-debug-eclipse/.
      Make sure to import it as Eclipse project and not as Maven project or it could break several pre-configured properties.
    2. Or Create it by hand
      1. Create XE Web Debug Project
      2. Mirror XE web in XE Web Debug Project
      3. Set XE Web Debug Project dependencies using M2Eclipse
  2. Import and link maven jar projects to debug
  3. Start XE Web Debug Project
  4. Troubleshoots
  5. Enjoy :)

Other useful tricks/tools

  • You should use XEclipse to edit wiki pages : XEclipseExtension.
  • 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.

TODO

Tags:
Created by Thomas Mortagne on 2008/04/08 20:14
Last modified by Thomas Mortagne on 2010/03/05 14:22

This wiki is licensed under a Creative Commons license
2.2.1.27354