- 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
. - Disable JavaScript validation for
node_modules
folder.Validation
→ click the...
settings button forJavaScript Validation
→ ifExclude Group
is not already in the list then clickAdd Exclude Group...
→Exclude Group
→Add Rule...
→Folder or file name
→Next
→Browse Folder...
→ navigate to thenode_modules
folder and confirm →Finish
.
- We do not validate HTML, JSP, and XML.
-
-
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.
NOTE
If you are migrating from Eclipse, you should delete
.project
,.classpath
,.launches
,src/main/webapp/WEB-INF/classes
,src/main/webapp/WEB-INF/lib
andsrc/main/webapp/WEB-INF/appengine-generated
.
You can also copylocal_db.bin
fromsrc/main/webapp/WEB-INF/appengine-generated
to the location your dev server in IntelliJ reads the datastore from after your IntelliJ setup. See dev server setup for more details.
-
You need a Java 7 SDK with the name
1.7
defined in IntelliJ IDEA as follows:- If you have no current projects open, click
Configure → Project Defaults → Project Structure
.
OR
If you currently have projects open, clickFile → Project Structure
. - Select SDKs in Platform Settings and check if there is a SDK named
1.7
with a JDK home path pointing to a JDK 7 path. Otherwise add a new SDK using JDK 7 with a name of1.7
.
- If you have no current projects open, click
-
You need the system property
ide=idea
forGradle VM options:
underGlobal Gradle settings
as follows:- If you have no current projects open, click
Configure → Settings/Preferences
.
OR
If you currently have projects open, clickFile → Settings
orIntelliJ IDEA → Preferences
. - Go to
Build, Execution, Deployment → Build Tools → Gradle
. UnderGlobal Gradle settings
, add-Dide=idea
toGradle VM options:
.
- If you have no current projects open, click
-
You need to have an application server named
AppEngine Dev <version>
pointing to the SDK you downloaded previously as follows:- If you have no current projects open, click
Configure → Settings/Preferences
.
OR
If you currently have projects open, clickFile → Settings
orIntelliJ IDEA → Preferences
. - Go to
Build, Execution, Deployment → Application Servers
. - Click
+ → Google App Engine Dev Server → ...
. Select the App Engine SDK (appengine-java-sdk-<version>
sub-folder) you downloaded in Step 3 of the Setting up a development environment guide. - Ensure the
Name:
is ofAppEngine Dev <version>
.
- If you have no current projects open, click
If you do not wish to use the automated setup, you can follow the manual setup below.
-
Run this command to create a pre-configured IntelliJ IDEA project:
./gradlew setupIntellijProject
-
Open the project in IntelliJ IDEA. It will generate some user specific settings. Wait for it to finish indexing.
-
Run this command to automatically configure your user specific settings:
./gradlew setupIntellijProjectSettings
-
To set up some static analysis tools, refer to this document.
NOTE
The behavior of the automated setup is described here.
-
Import the project as a Gradle project as follows:
- If you have no current projects open, click
Import Project
.
OR
If you currently have projects open, clickNew | Project from Existing Sources...
. - Select the local repository folder and click
Open
. - Select
Import project from external model
and thenGradle
. - Click
Next
. - Check
Use auto-import
and uncheckCreate separate module per source set
. - Ensure
Create directories for empty content root automatically
is unchecked. - Ensure
Use default gradle wrapper
is selected. - Ensure for
Gradle JVM:
that a JDK 7 with a name of1.7
is selected. - Click
Finish
. - Create a
build
folder in your project root if it does not exist while waiting for IntelliJ to finish indexing. - If you used a different project root directory other than
teammates
, you will receive a dialog box with the messageThe modules below are not imported from Gradle anymore. Check those to be removed from the ide project too:
.
You should see a module with your project root directory name being checked. ClickOK
. - Go to
File → Project Structure... → Modules
. Click on theteammates
module, then underSources
, click on thebuild
folder and clickExcluded
and thenOK
. - You should see a dialog box with the message:
Frameworks detected: Google App Engine, Web, JPA frameworks are detected in the project
.
OR
Frameworks detected: OSGi, Google App Engine, Web, JPA frameworks are detected in the project
.
ClickConfigure
and ensure that onlyGoogle App Engine
andJPA
frameworks are shown, otherwise make sure you have excluded thebuild
folder in yourteammates
module. Then clickOK
.If you missed the dialog box, go to
View → Tool Windows → Event Log
. You should see the same message as the dialog box, clickConfigure
and thenOK
.
- If you have no current projects open, click
-
Configure the project settings as follows:
In TEAMMATES, we have standards defined for indentation. See Coding standards in Supplementary documents.
- Open
File → Settings
orIntelliJ IDEA → Preferences
. - Go to
Editor → Code Style
and ensure thatUse tab character
is unchecked forJava
,JavaScript
,JSON
,CSS
andXML
. - Ensure that
Tab size:
,Indent:
andContinuation indent:
are4
,4
and8
respectively for the different languages. - Ensure
HTML
hasUse tab character
unchecked and setTab Size:
,Indent:
andContinuation indent:
to2
,2
and4
respectively. - Ensure
JSP
hasUse tab character
unchecked and setTab Size:
,Indent:
andContinuation indent:
to2
,2
and4
respectively.
Go to
Editor → File Encodings
and ensure thatProject Encoding
andDefault Encoding for properties files
is set toUTF-8
.Go to
Languages & Frameworks → JavaScript
and selectECMAScript 6
for theJavaScript language version
.- Open
View → Tool Windows → Gradle
. - Under
Tasks → intellij idea setup
, look for the taskenhanceIntellijOutputClasses
. - Right click and select
Execute After Build
.
- Open
-
Click
OK
. -
Run this command to set up the run configurations for IntelliJ:
./gradlew setupIntellijRunConfigs
-
To set up some static analysis tools, refer to this document.