Setting up a Gradle Project

This documentation describes how to set up a Gradle project for CaptainCasa.

Overview

Repository Location

CaptainCasa provides the following Maven repository location that is used from Gradle:

https://www.captaincasa.com/mavenrepository

 

Artifacts

In this repository there are a couple of artifacts:

/mavenrepository

    /org

        /eclnt

            /eclntjsfserverRISC       => CaptainCasa environment (RISC only)

            /eclntjsfserver_jsfimpl   => CaptainCasa mini JSF implementation

            /eclntpbc                 => Page Bean Components (addons)
           /eclntccee                => CaptainCasa CCEE (addons)

            /eclnteditor              => CaptainCasa Editor/Toolset

            ...

 

There are two artifacts that are used to set up your Gradle project.

Project <==> Deployment Tomcat

By default the CaptainCasa installation comes with an own Tomcat instance running the application that you build. And it comes with some tooling (Layout Editor), that manages this Tomcat:

Of course you may also think about running some Tomcat instance which is managed by your development environment (e.g. Eclipse). But this is not the CaptainCasa-default scenario, so this documentation assumes to develop your project on the left side – and run your project in some Tomcat on the right side, having the CaptainCasa toolset as linkage between.

In other words:

The result is a very efficient way of developing user interfaces – which is not burdened by always running full Gradle builds and by always deploying full systems to the Tomcat instance. - Debugging your application can easily be done by remote debugging.

Creating the Gradle project

Create the project

Open “File > New Gradle-project” from the menu:

The following dialog will show up:

In the dialog define:

Import the project into your IDE

Now import the Gradle-project in you IDE.

Example: in Eclipse you need to …

Build the project inside your IDE

Now build the project by starting Gradle-task “build” so that dependencies are resolved and the result is written into the target-directory.

Reload the project within the CaptainCasa tool set

By reloading, the target directory of your project is copied into the webapps-directory of your local Tomcat and the web application is reloaded.

Develop – Make – Deploy – Test

Develop & Make

The environment that was created during all this procedure now is:

The rounded arrows are showing the typical steps during development:

The straight arrows are showing what happens when a “Reload” is executed within the CaptainCasa toolset:

After the copying the “Reload” then restarts the “<projectName>”-web application by using the Tomcat manager API.

You may wonder: why are there three copying steps for loading the application into the Tomcat – and not only one, copying the Gradle-build into the Tomcat-webapps?

The reason is that by this procedure the number of Gradle builds that you need to do during development time is drastically reduced. A Gradle build typically takes quite some time, and it is just annoying to execute this build after every simple development activity.

Due to the copying above the Tomcat is constantly updated not only from the “target/<projectName>” directory, but also from the directories in which you typically work in when doing UI developments. You only have to run a full Gradle build, if really e.g. changing dependencies, so that new .jar files are to be copied into the Tomcat environment.

Use of hot deployment

Just as with usual CaptainCasa projects you can use hot deployment to significantly reduce deployment times. Hot deployment is activated from the CaptainCasa tool set:

Open “Configuration → Hot Deployment”...

...and defined the packages to be hot deployed (or “all packages”) in the follow-on dialog:

More details on Hot Deployment are contained in the Developers' Guide.

Updating the CaptainCasa Version

After having created your project with e.g. CaptainCasa version “20220425” you may later on update to a newer CaptainCasa version. For updating your project to a new CaptainCasa version you just need to execute the following steps: