Eclipse Configuration
1 Overview
If you intend to develop on eXo codebase, you will need to setup your development environment.
This documentation will help you configure Eclipse for the eXoProjects environment.
Before generating the eclipse configuration, you need to have built successfully the ecm or portal product.
Before configuring, we should make sure
base structure is properly set for eXo Platform.
- Download the latest Eclipse version from http://www.eclipse.org.
- Launch eclipse. Specify a location for your workspace.
- Open "Window" => "Preferences...". In the menu, go to "Java" - "Build Path" - "Classpath Variables" and create a classpath variable named "M2_REPO" with the value of your maven repository location. It should be "D:/java/exo-dependencies/repository".
- Import Projects
- In the menu bar choose File => Import. Choose General -> Existing Projects into Workspace.
- In the Select Root directory field, enter $javaDir/eXoProjects/$module/trunk. Click refresh to refresh the list of the available projects
- Once you have selected the directory, a list of projects should appear. Select all and make sure that "Copy projects into workspace" is NOT selected before finishing.
- Projects are now imported to Eclipse.
- Configure Working Sets
- In the "Package Explorer" window, click on the small down arrow, at the top right of the panel.
- In the list that appears, select "Top Level Elements" - "Working Sets".
- In the same list, click "Configure Working Sets..." and create a new working set with the name eXoProjects/$module/trunk. This name can change in the future, depending on which version you are working on.
- Select the projects with the id exo.$module.... from the list under, and click "Finish".
- In the "Select Working Sets" window, check the checkbox in front of the Working Set we've just created, and click OK to finish.
- Configure Code Style And Formater
- Open "Window" - "Preferences..." and navigate in the menu to : "Java" - "Code Style" - "Code Templates". Click import and choose the path $javaDir/eXoProjects/tools/trunk/config/EclipsePreferences/Java-CodeStyle-CodeTemplates.xml
- In the new template, select "Code" - "New Java files" and click "Edit..." to change your name, email address...
- Navigate to "Java" - "Code Style" - "Formatter". Click import and enter $javaDir/eXoProjects/tools/trunk/config/EclipsePreferences/Java-CodeStyle-Formater.xml
- Navigate to "General" - "Editors" - "Text Editors" : and change the following values :
- Displayed tab width : 2
- Check Show print margin and set the column to 100
- Check Show line numbers
Click "OK" to finish and "Yes" if a full rebuild is required.
3 Create Eclipse projects configuration
Go to $EXO_BASE_DIRECTORY/java/eXoProjects/$module/trunk directory and run the command
This command will generate the files .classpath , .project and .setting in each maven project
4 For Advanced developer
- Usually , you only need to work on a module such portal, ecm… So you only need to generate the eclipse configuration for a module only. When you create this configuration, you only have the projects within the module are linked to each other. You can also generate configuration for 2 or 3 different modules and import them into the same Eclipse workspace. But you won't have the feature like refractor, code link....
- If you want generate the configuration for more than one module, create a pom.xml in eXoProjects dir and enter the modules you want to work on. In the pom.xml, you should have some thing like:
[...]
<modules>
<module>kernel/trunk</module>
<module>core/trunk</module>
<module>portal/trunk</module>
</modules>
[...]
In the eXoProjects directory, run the command
To generate the eclipse configuration