Debugging
Eclipse with GWT
Download and install GWT
- GWT SDK
- Eclipse Plugin
- Installation Instructions
- Direct download link
- Browser Plugin
Download a recent XWiki snapshot
Import gwt projects into workspace
Checkout source code for e.g. xwiki/xwiki-platform from Github, which is described here .
Go into project directory "./xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-client/", open a command prompt and run the following command to prevent Eclipse from importing the project as maven project.
Add the following preferences to the "maven-eclipse-plugin" and "gwt-maven-plugin" plugin in "./xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-client/pom.xml"
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<projectNameTemplate>[groupId].[artifactId]</projectNameTemplate>
<addGroupIdToProjectName>false</addGroupIdToProjectName>
<wtpversion>2.0</wtpversion>
<projectnatures>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
</projectnatures>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<includes>org/xwiki/gwt/wysiwyg/WysiwygTestSuite.java</includes>
<buildOutputDirectory>${webappDirectory}/WEB-INF/classes</buildOutputDirectory>
<module>org.xwiki.gwt.wysiwig.Wsyiwyg</module>
<webappDirectory>${webappDirectory}</webappDirectory>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>
Within adding this you have to skip the Checkstyle configurations to be able to build the project by adding <skip>true</skip>.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
Open Eclipse, go to the Package Explorer and right-click Import...> Existing Projects into Workspace> xwiki-platform-wysiwyg-client. After that you may have errors in your project. To solve this delete the target folders and run
Debug Configurations
Next right-click on Project Debug As...> Debug Configurations and set configurations as shown on the following images.
Go to Web Application> New launch configuration to the Main tab, set
- the Project (e.g. "xwiki-platform-wysiwyg-client")
- and Main class "com.google.gwt.dev.DevMode".
Hit the "Server" tab and uncheck "Run built-in server".
Switch to the "GWT" tab and add the following URL http://localhost:8080/xwiki/bin/edit/Sandbox/Test?editor=wysiwyg
Next switch the tab and add the following arguments.
-war C:\Temp\xwiki-enterprise-jetty-hsqldb-5.2-20130627.090543-2\xwiki-enterprise-jetty-hsqldb-5.2-SNAPSHOT\webapps\xwiki
-startupUrl http://localhost:8080/xwiki/bin/edit/Sandbox/Test?editor=wysiwyg
-remoteUI "${gwt_remote_ui_server_port}:${unique_id}"
-logLevel INFO
-codeServerPort auto org.xwiki.gwt.wysiwyg.Wysiwyg org.xwiki.gwt.wysiwyg.WysiwygDev
Change the "Working Directory" to "other" and paste the location of your current XWiki snapshot.
Right-click your certain project (e.g. xwiki-platform-wysiwyg-client) in eclipse and select Properties> Google> Web Toolkit and check Use Google Web Toolkit
If you need to debug more than just one project at the same time, you have to repeat these steps for e.g. xwiki-platform-gwt-user and modificate the classpath of the launch configuration. In practice this means for each project that is dependent of you have to add its source/resource directories. Follow these steps as described here and shown by the screenshot.
- select "Classpath" tab
- select "User Entries"
- press "Advanced"
- select "Add folder"
Go to the directory of your current XWiki snapshot, open a command prompt and run start_xwiki_debug.bat
Right-click on Project Debug As...> Debug Configurations> Debug. Maybe there will pop-up the following dialog, you don't have to consider this, just confirm with "yes".
Now set e.g. a breakpoint and double click the URL like shown in the picture below to debug the wysiwyg-editor.