Wiki source code of Working with Eclipse
Last modified by Thomas Mortagne on 2023/06/08 09:55
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{box cssClass="floatinginfobox" title="**Contents**"}} | ||
2 | {{toc/}} | ||
3 | {{/box}} | ||
4 | |||
5 | This document contains instructions on how to configure Eclipse for building and developing XWiki. It should be noted that these are generic instructions, some components / sub-projects of XWiki might require specific configurations on Eclipse that may not be covered in this document. | ||
6 | |||
7 | {{warning}} | ||
8 | It is necessary that you [[Install & Configure Maven>>Building||anchor="HInstallingMaven"]] before trying anything here. | ||
9 | {{/warning}} | ||
10 | |||
11 | = Prerequisites = | ||
12 | |||
13 | * Knowledges: | ||
14 | ** This tutorial does not explain how Eclipse/JDT works and how to install Eclipse plugins | ||
15 | ** 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>>Building]]. | ||
16 | ** You should take a look at general [[XWiki's sources repository structure>>SourceRepository]]. | ||
17 | * Tools | ||
18 | ** Java JDK 11 or superior | ||
19 | |||
20 | = Get the source for XWiki = | ||
21 | |||
22 | [[Clone platform repository>>SourceRepository]] somewhere in your computer different from your Eclipse workspace: | ||
23 | |||
24 | {{code language="none"}} | ||
25 | git clone [email protected]:xwiki/xwiki-platform.git | ||
26 | {{/code}} | ||
27 | |||
28 | or replace ##[email protected]:xwiki/xwiki-platform.git## with your own fork of platform. | ||
29 | |||
30 | = Installing Eclipse = | ||
31 | |||
32 | * You can download Eclipse from the [[Eclipse Download Site>>http://www.eclipse.org/downloads/]]. Alternatively, you can download one of the many Eclipse distributions, such as the "Eclipse IDE for Java EE Developers" which includes other features and plugins such as the [[Web Tools Project>>http://www.eclipse.org/webtools/]]. | ||
33 | * Install the [[Maven Eclipse plugin>>https://www.eclipse.org/m2e/]] (if you installed "Eclipse IDE for Java EE - Kepler" distribution, the Maven Eclipse plugin is already bundled with it) | ||
34 | * Optionally you might want to install the Web Tools Project (WTP) feature if you want to deploy XWiki to a support server without having to leave the Eclipse IDE, See [[The WTP homepage>>http://www.eclipse.org/webtools/]] for details and [[Installing and Using the Eclipse Web Tools>>http://wiki.eclipse.org/WTP_FAQ#How_do_I_install_WTP.3F]] for help. (this is not needed if you installed the "Eclipse IDE for Java EE" distribution) | ||
35 | * [Optional] You might also want to work on AspectJ based legacy code legacy, for that you should install the [[AJDT Eclipse plugin>>http://www.eclipse.org/ajdt/]]. | ||
36 | |||
37 | = Importing a project With M2Eclipse = | ||
38 | |||
39 | * Now we're going to import the XWiki source (checked out above) into your Eclipse workspace. Select **[File->Import]** and under the **Maven** category, select **Existing Maven Projects** and click **Next**. | ||
40 | * On the next screen, point **Root Directory** to whatever XWiki module you wish to work on. If you point the Root Directory to top-level repository folder, you will end up with a gazillion Eclipse projects. Therefor only select the module you wish to work on, and keep in mind that M2Eclipse will take care of dependencies. | ||
41 | * Finally, click **Finish** to dismiss the import wizard and let the workspace adjust itself (this will take some time depending on the number of projects to be imported). | ||
42 | * Now you can execute maven goals simply by right-clicking on the project and then **[Run As-><Maven Goal>]**. Observe the output from maven now appearing on the **Console** viewer of Eclipse. | ||
43 | * That's it! Happy Hacking... | ||
44 | |||
45 | = Other useful tricks/tools = | ||
46 | |||
47 | * To dynamically validate your java code on XWiki codestyle you should use and configure the [[Eclipse Checkstyle plugin>>DevelopmentTools||anchor="HEclipse-cs"]]. | ||
48 | * Look at [[Development Tools>>DevelopmentTools]] for a list of useful development tools. | ||
49 | * You can use [[XEclipse>>extensions:Extension.XWiki Eclipse]] to edit wiki pages. {{warning}}XEclipse was once maintained by the XWiki Development Team but for lack of active development [[has been moved as a Contrib project>>http://markmail.org/thread/7wv5fbczdcnvvdsa]] and now depends on the community for any future evolution. It is no longer supported by the XWiki Development Team.{{/warning}} | ||
50 | |||
51 | = Debug XWiki = | ||
52 | |||
53 | * [[Debug XWiki using WTP>>DebugXEWithEclipse]] |