Eclipse
Prerequisites
- Install Maven
- Install Git
- Configuring ssh keys for stash and git ()
- Get the corresponding jdk
- Retrieve BlueMind's sources as described in our page: Contributing to BlueMind
Remember to check that you're on Ubuntu Xorg when you log in (it may cause Eclipse rachs if you're not).
Installing Git
Generate a local ssh key with your e-mail address
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Then copy the generated key
cat ~/.ssh/id_ed25519.pub
And add it to your git profile (and stash if used)
Installation
Download and install Eclipse for RCP and RAP developers.
Configuration
Launch Settings
Add a shortcut for Eclipse in your /home/USER/.local/share/applications/
as defined below. Remember to change USER
with your username.
cat /home/USER/.local/share/applications/_home_USER_eclipse_.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=/home/USER/bin/eclipse.sh %u
Icon=/home/USER/eclipse/icon.xpm
Categories=Application;Development;Java;IDE
Type=Application
StartupNotify=true
StartupWMClass=Eclipse
Terminal=0
MimeType=x-scheme-handler/eclipse+command;x-scheme-handler/eclipse+mpc;
Create a file eclipse.sh
in your home as defined below. Remember to change USER
with your username.
cat /home/USER/bin/eclipse.sh
#!/bin/sh
export WEBKIT_DISABLE_COMPOSITING_MODE=1
/home/USER/eclipse/eclipse -vm /usr/lib/jvm/java-1.21.0-openjdk-amd64/bin/java
In your local repository, create a .envrc
that will contain the local configuration. You need to enter the paths to the jdk and to the maven you've installed. Remember to change USER
with your username.
cat /home/USER/local/bluemind-all/.envrc
branch=$(git rev-parse --abbrev-ref HEAD)
branch=$(echo $branch | sed 's,/,_,')
unset _JAVA_OPTIONS
#export MAVEN_OPTS="-Dmaven.repo.local=/home/USER/.m2/${branch}"
export MAVEN_OPTS="-Dmaven.repo.local=/home/USER/.m2/master"
export JAVA_HOME=/usr/lib/jvm/jdk-21.0.3
export PATH=/usr/local/apache-maven-3.9.7/bin:/usr/lib/jvm/jdk-21.0.3/bin:$PATH
To take this conf into account, we use direnv. Update your .bashrc to include this row:
eval "$(direnv hook bash)
In your Eclipse :
- Open Window -> Preferences
- Search for Installed JREs
- In the list, select the jdk, click Edit...
- Add the following line in the Default VM arguments field
--add-modules java.se --illegal-access=permit --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-exports java.base/jdk.internal.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED -Djava.net.preferIPv4Stack=true -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -XX:StartFlightRecording=delay=2s,settings=profile,dumponexit=true
Adding an execution platform
The Eclipse execution platform must be completed with BlueMind dependencies:
- start and initialize a workspace using the version of Eclipse you want to develop with (e.g. Eclipse Mars, previously installed)
- go to Window->Preferences, search for Target
- click Target Platform
- click Add, choose Nothing, click Next
- specify a name (e.g. BlueMind 5)
- click Add, choose Software Site, then click Next
- in the «Work with» field, specify http://forge.blue-mind.net/staging/p2/dependencies and point to the latest version
- at the bottom of the window uncheck "Group by category" and "Include required software"
- in the updated list, check Feature:
- click Finish
- make sure the new platform is selected and click on Apply then OK to exit:
Configuration
Formatting
To use uniform code formatting in Eclipse:
- go to Window, then Preference
- search for Save Actions, click Java->Editor->Save Actions
- check Perform the selected actions on save
- check Format source code, and select Format all lines
- check Organize imports
- click Apply, then OK
Headers
It is important that source file headers are compliant. In Eclipse:
- go to Window, then Preference
- search for Template, click Java->Code Style->Code Template
- open the Code menu and click New Java files
- click Edit
- in the Pattern section, add: New Java file pattern
/\* BEGIN LICENSE
\* Copyright © Blue Mind SAS, 2012-${year}
\*
\* This file is part of BlueMind. BlueMind is a messaging and collaborative
\* solution.
\*
\* This program is free software; you can redistribute it and/or modify
\* it under the terms of either the GNU Affero General Public License as
\* published by the Free Software Foundation (version 3 of the License).
\*
\* This program is distributed in the hope that it will be useful,
\* but WITHOUT ANY WARRANTY; without even the implied warranty of
\* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\*
\* See LICENSE.txt
\* END LICENSE
\*/
${filecomment}
${package_declaration}
${typecomment}
${type_declaration} - click OK
- click Apply, then OK
Initializing the Eclipse workspace
"Package explorer"
Before you import the plugins, you must make sure that you are using the "Package explorer" view to browse plugins (for performance reasons).
To open it:
- Go to Window / Show View
- If it doesn't appear here, click "Other" and you will find it in the "Java" category
- Close other plugin list views such as "Project Explorer" or "Plugins..."
Importing plugins
In Eclipse
- go to File, Import menu
- open General, select Existing projects into Workspace
- click Next
- check Select root directory, click Browse
- select the open folder in the BlueMind Git, and click OK
- if there is only one project in the Projects list, clean up the Git. Go to the BlueMind Git root directory and run: git clean -f -d -n -x, then start again from step 1
- otherwise, click Finish
- repeat this operation for the closed BlueMind Git directory
Build maven
You must add a Maven build:
- in a terminal, go to the open BlueMind Git directory
- run the command: mvn -Dmaven.test.skip=true clean install
- do the same in the directory open/ui/gwt-libs/
- in Eclipse, select all the packages and press F5 (Refresh)