Wiki source code of Debugging
Last modified by Marius Dumitru Florea on 2017/08/25 12:03
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{warning}} | ||
2 | The GWT WYSIWYG editor is no longer available starting with XWiki 9.7. It has been replaced by [[CKEditor>>extensions:Extension.CKEditor Integration.WebHome]]. | ||
3 | {{/warning}} | ||
4 | |||
5 | {{toc start="2"/}} | ||
6 | |||
7 | == Eclipse with GWT == | ||
8 | |||
9 | === Download and install GWT === | ||
10 | |||
11 | * [[GWT SDK>>url:http://www.gwtproject.org/gettingstarted.html]] | ||
12 | * Eclipse Plugin | ||
13 | ** [[Installation Instructions>>https://developers.google.com/eclipse/docs/install-eclipse-4.2]] | ||
14 | ** Direct download [[link>>http://dl.google.com/eclipse/plugin/4.2]] | ||
15 | * [[Browser Plugin>>http://gwt.googleusercontent.com/samples/MissingPlugin/MissingPlugin.html]] | ||
16 | |||
17 | === Download a recent XWiki snapshot === | ||
18 | |||
19 | * [[http://maven.xwiki.org/snapshots/org/xwiki/enterprise/xwiki-enterprise-jetty-hsqldb/]] | ||
20 | |||
21 | === Import gwt projects into workspace === | ||
22 | |||
23 | Checkout source code for e.g. [[xwiki/xwiki-platform>>https://github.com/xwiki/xwiki-platform]] from Github, which is described [[here >>http://dev.xwiki.org/xwiki/bin/view/Community/SourceRepository#HGettingSources]]. | ||
24 | |||
25 | 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. | ||
26 | |||
27 | {{code language="console"}} | ||
28 | >mvn eclipse:clean eclipse:eclipse | ||
29 | {{/code}} | ||
30 | |||
31 | {{info}} | ||
32 | If you have never done this before, have a look at [[Building XWiki from sources>>http://dev.xwiki.org/xwiki/bin/view/Community/Building#HInstallingMaven]] | ||
33 | {{/info}} | ||
34 | |||
35 | 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" | ||
36 | |||
37 | {{code language="xml"}} | ||
38 | <plugin> | ||
39 | <groupId>org.apache.maven.plugins</groupId> | ||
40 | <artifactId>maven-eclipse-plugin</artifactId> | ||
41 | <version>2.9</version> | ||
42 | <configuration> | ||
43 | <projectNameTemplate>[groupId].[artifactId]</projectNameTemplate> | ||
44 | <addGroupIdToProjectName>false</addGroupIdToProjectName> | ||
45 | <wtpversion>2.0</wtpversion> | ||
46 | <projectnatures> | ||
47 | <nature>org.eclipse.wst.common.project.facet.core.nature</nature> | ||
48 | <nature>org.eclipse.jdt.core.javanature</nature> | ||
49 | <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> | ||
50 | <nature>org.eclipse.jem.workbench.JavaEMFNature</nature> | ||
51 | <nature>com.google.gwt.eclipse.core.gwtNature</nature> | ||
52 | </projectnatures> | ||
53 | </configuration> | ||
54 | </plugin> | ||
55 | <plugin> | ||
56 | <groupId>org.codehaus.mojo</groupId> | ||
57 | <artifactId>gwt-maven-plugin</artifactId> | ||
58 | <configuration> | ||
59 | <includes>org/xwiki/gwt/wysiwyg/WysiwygTestSuite.java</includes> | ||
60 | <buildOutputDirectory>${webappDirectory}/WEB-INF/classes</buildOutputDirectory> | ||
61 | <module>org.xwiki.gwt.wysiwig.Wsyiwyg</module> | ||
62 | <webappDirectory>${webappDirectory}</webappDirectory> | ||
63 | <hostedWebapp>${webappDirectory}</hostedWebapp> | ||
64 | </configuration> | ||
65 | </plugin> | ||
66 | {{/code}} | ||
67 | |||
68 | Within adding this you have to skip the Checkstyle configurations to be able to build the project by adding {{code language="xml"}}<skip>true</skip>{{/code}}. | ||
69 | |||
70 | {{code language="xml"}} | ||
71 | <plugin> | ||
72 | <groupId>org.apache.maven.plugins</groupId> | ||
73 | <artifactId>maven-checkstyle-plugin</artifactId> | ||
74 | <configuration> | ||
75 | <skip>true</skip> | ||
76 | </configuration> | ||
77 | </plugin> | ||
78 | {{/code}} | ||
79 | |||
80 | Open Eclipse, go to the Package Explorer and right-click {{code}}Import...> Existing Projects into Workspace> xwiki-platform-wysiwyg-client{{/code}}. After that you may have errors in your project. To solve this delete the target folders and run | ||
81 | |||
82 | {{code language="console"}} | ||
83 | >mvn clean install | ||
84 | {{/code}} | ||
85 | |||
86 | === Debug Configurations === | ||
87 | |||
88 | Next right-click on Project {{code}}Debug As...> Debug Configurations{{/code}} and set configurations as shown on the following images. | ||
89 | |||
90 | Go to {{code}}Web Application> New launch configuration{{/code}} to the Main tab, set | ||
91 | |||
92 | * the Project (e.g. "xwiki-platform-wysiwyg-client") | ||
93 | * and Main class "com.google.gwt.dev.DevMode". | ||
94 | |||
95 | [[[[image:xwiki-wysiwyg-plugins-1-project-debug-configurations-marked.PNG||width="680px"]]>>attach:xwiki-wysiwyg-plugins-1-project-debug-configurations-marked.PNG]] | ||
96 | |||
97 | Hit the "Server" tab and uncheck "Run built-in server". | ||
98 | |||
99 | [[[[image:xwiki-wysiwyg-plugins-2-project-debug-configurations.PNG||width="680px"]]>>attach:xwiki-wysiwyg-plugins-2-project-debug-configurations.PNG]] | ||
100 | |||
101 | Switch to the "GWT" tab and add the following URL {{code}}http://localhost:8080/xwiki/bin/edit/Sandbox/Test?editor=wysiwyg{{/code}} | ||
102 | |||
103 | [[[[image:xwiki-wysiwyg-plugins-3-project-debug-configurations.PNG||width="680px"]]>>attach:xwiki-wysiwyg-plugins-3-project-debug-configurations.PNG]] | ||
104 | |||
105 | Next switch the tab and add the following arguments. | ||
106 | |||
107 | {{code}} | ||
108 | -noserver | ||
109 | -war C:\Temp\xwiki-enterprise-jetty-hsqldb-5.2-20130627.090543-2\xwiki-enterprise-jetty-hsqldb-5.2-SNAPSHOT\webapps\xwiki | ||
110 | -startupUrl http://localhost:8080/xwiki/bin/edit/Sandbox/Test?editor=wysiwyg | ||
111 | -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" | ||
112 | -logLevel INFO | ||
113 | -codeServerPort auto org.xwiki.gwt.wysiwyg.Wysiwyg org.xwiki.gwt.wysiwyg.WysiwygDev | ||
114 | {{/code}} | ||
115 | |||
116 | {{warning}} | ||
117 | Replace "C:\Temp\xwiki-enterprise-jetty-hsqldb-5.2-20130627.090543-2\xwiki-enterprise-jetty-hsqldb-5.2-SNAPSHOT\webapps\xwiki" with the location of your current XWiki snapshot. | ||
118 | {{/warning}} | ||
119 | |||
120 | Change the "Working Directory" to "other" and paste the location of your current XWiki snapshot. | ||
121 | |||
122 | [[[[image:xwiki-wysiwyg-plugins-4-project-debug-configurations.PNG||width="680px"]]>>attach:xwiki-wysiwyg-plugins-4-project-debug-configurations.PNG]] | ||
123 | |||
124 | Right-click your certain project (e.g. xwiki-platform-wysiwyg-client) in eclipse and select {{code}}Properties> Google> Web Toolkit{{/code}} and check {{code}}Use Google Web Toolkit{{/code}} | ||
125 | |||
126 | {{warning}} | ||
127 | As of a eclipse bug you maybe have to repeat that step another time before the setting gets active. | ||
128 | {{/warning}} | ||
129 | |||
130 | If you need to debug more than just one project at the same time, you have to repeat these steps for e.g. (% class="box code" %)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. | ||
131 | |||
132 | * select "Classpath" tab | ||
133 | * select "User Entries" | ||
134 | * press "Advanced" | ||
135 | * select "Add folder" | ||
136 | |||
137 | [[[[image:xwiki-wysiwyg-plugins-7-project-debug-configurations.PNG||width="680px"]]>>attach:xwiki-wysiwyg-plugins-7-project-debug-configurations.PNG]] | ||
138 | |||
139 | {{warning}} | ||
140 | These dependencies must be before "(default classpath)" as shown by the screenshot, so the hosted mode can recognize direct change. | ||
141 | {{/warning}} | ||
142 | |||
143 | Go to the directory of your current XWiki snapshot, open a command prompt and run {{code}}start_xwiki_debug.bat{{/code}} | ||
144 | |||
145 | {{info}} | ||
146 | Your environment variables have to be in 8.3 DOS path format to execute this batch-file | ||
147 | {{/info}} | ||
148 | |||
149 | Right-click on Project {{code}}Debug As...> Debug Configurations> Debug{{/code}}. Maybe there will pop-up the following dialog, you don't have to consider this, just confirm with "yes". | ||
150 | |||
151 | [[image:xwiki-wysiwyg-plugins-5-project-debug-configurations.PNG]] | ||
152 | |||
153 | Now set e.g. a breakpoint and double click the URL like shown in the picture below to debug the wysiwyg-editor. | ||
154 | |||
155 | [[image:xwiki-wysiwyg-plugins-6-project-debug-configurations.PNG]] |