Developing from Source - Inside Eclipse - Documentation topics on: development,eclipse,eclipse plugins,installation,setting up a development environment in eclipse,.

Developing from Source - Inside Eclipse

There are different ways to set up dotcms to run in debug mode, which allows you to hot swap class and code changes (for the most part). You can run dotCMS standalone, from release, and connect to it via remote debugging as described in other documents, or you can run from Eclipse in debug mode. Either way is effective.

This document describes how to run dotCMS in debug mode inside Eclipse and uses Eclipse Luna IDE for Web Developers on OS-X.  It assumes you have Java 8 installed on your system.

From a terminal screen

1. Pull down the dotCMS source

mkdir ~/dotcms
cd ~/dotcms

then download the latest dotCMS version from github

git clone https://github.com/dotCMS/core.git

2. Build a dotCMS installation

Once you have pulled down the source code, use gradle to initialize, deploy and build a working dotCMS installation.  Gradle supplies a gradle "wrapper" called gradlew that does not require any dependencies.

cd core
./gradlew deploy-war-tomcat

This will create a "tomcat8" directory under the ~/dotcms folder that is a plain vanilla tomcat 8 installation with dotCMS deployed under the tomcat8/webapps/ROOT directory.  Do not start tomcat yet.

In Eclipse

3. Create a new Project

New > Project > Java > Java Project
Name: dotcms
Location: /Users/XXXXX/dotcms/core

Hit "finish" and Ecliipse should configure the JRE and source for you.  The project will be red and not compile at this point.

Now, from the "File" menu, create a new Folder.  File > New > Folder.  Click the >> Advanced button and select the "Link to alternate location (Linked Folder)" button.  Browse and link to the ~/dotcms/tomcat8 directory that you created in step 2 using the gradle command.

4. Configure your build path 

Right click on your project and select "Build Path > Configure Build Path"

remove all plugin examples - found under ./docs/examples src from the Source
add ./src-conf to the Source

Change the "Default output folder" to dotcms/tomcat8/webapps/ROOT/WEB-INF/classes

Once this is done, your Eclipse project should build without problems.  If your project is not building, make sure you followed the steps above.

5. Create a New Debug Configuration

In Eclipse, go to Debug Configurations and add a new "Java Application" debug configuration.

ParameterValue(s)
Name
dotcms
Project
dotcms
Main Class
org.apache.catalina.startup.Bootstrap
VM Arguments
-Xmx2G
-Dfile.encoding=UTF8
-Dcatalina.home=“/Users/XXXXX/dotcms/tomcat8”
-Djava.io.tmpdir=“/Users/XXXXX/dotcms/tomcat8/temp”
-XX:MaxPermSize=256m
ClasspathBootstrap Entries:
  • tomcat-juli.jar
  • bootstrap.jar
  • JRE System Library

Eclipse Classpath Configuration
Source
  • src
  • dotCMS

In a browser, go to
http://127.0.0.1:8080/
the css will compile and the site should render

In another browser tab, go to 
http://localhost:8080/admin
login with admin@dotcms.com / admin

Note : using 127.0.0.1 for front end traffic will allow you to login at localhost:8080/admin under a different session. You can also use your browser in incognito mode for the same effect.