- Replace all references of
Eclipse → Preferences → ...
toWindow → Preferences → ...
if you are using Windows.- If you worry that these settings will interfere with your other projects, you can use a separate Eclipse instance for TEAMMATES.
Supported Eclipse versions: Eclipse IDE for Java EE Developers version Luna, Mars, or Neon.
The following plugins are needed:
- Google Plugin for Eclipse: the correct version for your Eclipse IDE.
- TestNG Eclipse plugin: latest stable.
-
Run this command to get necessary configuration files for Eclipse:
./gradlew setupEclipse
Verification: The files
.project
and.classpath
should be added to the project root directory. -
Start Eclipse and do the following works before importing the project:
-
Google App Engine: Go to
Eclipse → Preferences → Google → App Engine
, click theAdd
button, and point it to where Gradle keeps the downloaded SDK.
This directory can be found by running the command./gradlew printUserHomeDir
.
Further instructions for installing can be found here. -
JRE: Go to
Eclipse → Preferences → Java → Installed JRE
and ensure a JDK 1.7 (not JRE, not JDK 1.8) entry exists.
Note that none of the App Engine SDK or JDK to be used are required to be the
default
. -
-
Import the project to your Eclipse instance.
- Go to
File → Import...
. - Select
Existing Projects into Workspace
underGeneral
. - Set the
root directory
to the location where the repo is cloned. - Click
Finish
.
- Go to
-
Configure the following project-specific settings (all can be found in
Project → Properties → ...
):-
Text encoding:
Resources
→ change theText file encoding
setting fromDefault
toOther: UTF-8
. -
Google App Engine: set up the following by going to
Google → ...
:-
Datanucleus version:
App Engine → Datastore → Datanucleus JDO/JPA Version
→ selectv1
. -
ORM Enhancement:
App Engine → ORM
→ clear all the entries, and add the following entry:src/main/java/teammates/storage/entity/*.java
. -
Validation exclusion:
App Engine → Validation
→ add two entries:src/test/java
andsrc/client/java
. -
WAR directory:
Web Application
→ tick bothThis project has a WAR directory
andLaunch and deploy from this directory
, and entersrc/main/webapp
asWAR directory
.
-
-
JDK:
Java Build Path → Libraries
→ ensure that the system library used is JDK 7. -
Compiler compliance:
Java Compiler
→ tickUse compliance from execution environment 'JavaSE-1.7' on the 'Java Build Path'
. -
Indentation: In TEAMMATES, we use 4 spaces in place of tabs for indentations. Configure for all the languages used in TEAMMATES:
- Java:
Java → Code Style → Formatter → Edit → Tab policy → Spaces only
. - JavaScript:
JavaScript → Code Style → Formatter → Edit → Tab policy → Spaces only
. - HTML:
Web → HTML Files → Editor → Indent using spaces
. - CSS:
Web → CSS Files → Editor → Indent using spaces
. - XML:
XML → XML Files → Editor → Indent using spaces
.
- Java:
-
Validation: We do not validate HTML, JSP, and XML.
Validation
→ uncheck theBuild
option forHTML Syntax Validator
,JSP Content Validator
,JSP Syntax Validator
, andXML Validator
.
-
-
Clean
the project for all changes to take effect. Ensure that there are no errors. Warnings are generally fine and can be ignored. -
To set up some static analysis tools, refer to this document.
Supported IntelliJ versions: IntelliJ IDEA Ultimate Edition (required to work with Google App Engine). You can sign up for the free JetBrains student license if you are a student registered in an educational institution.
-
If you are an existing IntelliJ user and have a project open, close the project (
File → Close Project
) before continuing. -
Configure IntelliJ as follows:
- JRE: Click
Configure → Project Defaults → Project Structure
. UnderProject SDK
, clickNew → JDK
. Locate theJava
folder where you have installedJDK 1.7
. Selectjdk1.7.*
and clickOK
. - Indentation: In TEAMMATES, we use 4 spaces in place of tabs for indentation. Go to
Configure → Settings → Editor → Code Style
and ensure thatUse tab character
is unchecked forJava
,JavaScript
,HTML
,CSS
andXML
. - Text Encoding: Go to
Configure → Settings → Editor → File Encodings
and ensure thatIDE Encoding
andProject Encoding
are set toUTF-8
. - HTML/JSP syntax: We prefer not to use the HTML/JSP Inspections provided by IntelliJ. Go to
Configure → Settings → Editor → Inspections
and uncheckHTML
andJSP Inspections
.
- JRE: Click
-
Import the project into IntelliJ.
- Click
Import project
and select the local repository folder. - Click
Import project from external model → Gradle
. - Click
Next
. - Check
Use auto-import
. Ensure that1.7
is used for theGradle JVM
. - Click
Finish
.
- Click
-
In your
Event Log
, you should see this line:Frameworks detected: Google App Engine, Web, JPA frameworks are detected in the project
. ClickConfigure
andOK
in the dialog box that appears. -
Run this command to set up the necessary configuration files for IntelliJ:
./gradlew setupIntellij
-
To set up some static analysis tools, refer to this document.