Wiki source code of Working with IntelliJ IDEA

Last modified by Pierre Jeanjean on 2023/10/31 13:55

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 = Install IntelliJ IDEA =
6
7 * Download and Install [[IntelliJ IDEA>>http://www.jetbrains.com/idea/]]
8 * [[Setup IntelliJ IDEA so that it respects the code style of the XWiki project>>CodeStyle]]
9
10 = Get the source for XWiki =
11
12 The source for XWiki is available via a [[source repository>>SourceRepository]].
13
14 = Create an IntelliJ IDEA project =
15
16 IntelliJ IDEA supports Maven out of the box so all you need to do is open the ##pom.xml## file for the project you wish to build/debug.
17
18 = Building sources =
19
20 In IDEA's menu, click on ##Build > Make Project##.
21
22 = Enabling syntax highlighting for Velocity templates =
23
24 The XWiki project relies extensively on [[Velocity templates>>xwiki:Documentation.DevGuide.Scripting.XWikiVelocityTraining]].
25 It is possible to get support for syntax highlighting directly in the IDE by installing the following textmate bundle: [[https://github.com/textmate/java-velocity.tmbundle]].
26 This can be done by going to ##File > Settings > Editor > TextMate Bundles## and adding a local copy of the repository.
27
28 By default, simply installing this bundle will provide support for any ##.vm## file. However, most Velocity templates in XWiki are embedded in documents, stored as ##.xml## files.
29 The solution here is to use an extension that enables textmate language injection, such as [[https://plugins.jetbrains.com/plugin/22641-injectsense]].
30 Once installed, you might want to edit the default shortcuts in ##File > Settings > Keymap > Plugins > InjectSense##.
31 After that, when browsing an ##.xml## file that contains Velocity syntax, you can put your cursor between, //e.g.//, the ##<content>..</content>## tags, press your shortcut, and select ##Java Velocity## from the context menu.
32
33 = Troubleshooting =
34
35 == Plenty of errors in imports ==
36
37 This mean IDEA wasn't able to resolve the dependencies of the module you're in. One typical cause is because IDEA failed to read the XWiki Maven POMs. And one reason for that is that XWiki requires a [[recent version of Maven>>Community.Building.WebHome]], while IDEA may embed an oldish version. This is causing problems such as the one in the following screenshot, preventing IDEA from resolving dependencies:
38
39 {{image reference="maven-idea-bug.png" width="650px"/}}
40
41 You also need to make sure that you've [[configured Maven properly with a good ##settings.xml## file>>Community.Building.WebHome]].

Get Connected