CaptainCasa Toolset via Spring Boot and Maven

Overview

From topology point of view the CaptainCasa Toolset is a web application itself that can be deployed to any servlet environment.

“By default” it is part of the CaptainCasa-setup, which either comes as “setup.exe”-file for Windows system and which comes as “.tar”-file for Linux based systems and MacOS. During the installation a Tomcat instance is installed (directory “<installdir>/server/tomcattools”), in the corresponding webapp-folder you will find the “editor” web application.

But...: the web application is also available as “.war” Maven artifact. This “.war” file can be used in two ways:

java -jar eclnteditor_springboot-<version>.war

 

http://localhost:51000/editor

Advantages

Of course the first advantage is: there is a direct, “lightweight” way to install the CaptainCasa Toolset – without the environment installation that is part of the default installation.

The real, important advantage is a consequence out of this: it is now possible to embed the installation and the updates of the toolset into the build of your project. Speaking “in Maven” this means:

Maven artifact

The Maven artifact for the CaptainCasa toolset is:

<groupId>org.eclnt</groupId>

<artifactId>eclnteditor_springboot</artifactId>

<version>...version...</version>

 

The artifact is a “.war” file – it is not a “.jar” file!

It is part of the CaptainCasa repository at:

https://www.CaptainCasa.com/mavenrepository

 

Open the URL in your browser and you will directly get access to the newest version.

Embedding the toolset upgrade into project build

The following explanations are focusing on Maven-builds. If using Gradle as build-system then please adapt the few steps accordingly.

In your “pom.xml” add the following “plugin” definition:

...

<repositories>

    <repository>

        <id>org.eclnt</id>

        <url>https://www.captaincasa.com/mavenrepository</url>

    </repository>

    ...

</repositories>

...

<properties>

    <cc.version>20221107</cc.version>

</properties>

...

 

...

<dependency>

    <groupId>org.eclnt</groupId>

    <artifactId>eclntjsfserverRISC</artifactId>

    <version>${cc.version}</version>

</dependency>

<dependency>

    <groupId>org.eclnt</groupId>

    <artifactId>eclntjsfserver_jsfimpl</artifactId>

    <version>${cc.version}</version>

</dependency>...

 

...

<plugin>

    <groupId>org.apache.maven.plugins</groupId>

    <artifactId>maven-dependency-plugin</artifactId>

    <executions>

        <execution>

            <id>cctoolset-copy</id>

            <phase>package</phase>

            <goals>

                <goal>copy</goal>

            </goals>

            <configuration>

                <artifactItems>

                    <artifactItem>

                        <groupId>org.eclnt</groupId>

                        <artifactId>eclnteditor_springboot</artifactId>

                        <version>${cc.version}</version>

                        <type>war</type>

                        <overWrite>true</overWrite>

                        <outputDirectory>${project.basedir}/cctoolset</outputDirectory>

                        <destFileName>eclnteditor_springboot.war</destFileName>

                    </artifactItem>

                </artifactItems>

            </configuration>

        </execution>

    </executions>

</plugin>

...

 

The plugin downloads the “.war” artifact into the project's “cctoolset” directory.

Please make sure that this directory is available before running the Maven-build. After running the Maven build (“clean package”) you will find the file “cctoolset/eclnteditor_springboot.war” inside your project:

<project>

    ...

    cctoolset/

        eclnteditor_springboot.war

    ...

    src/

        main/

    src/

        test/

    ...        

 

You may add a start script into the same directory, e.g. for Windows:

<project>

    ...

    cctoolset/

        eclnteditor_springboot.war

        start.bat

 

Content of start.bat:

java -jar eclnteditor_springboot.war

 

Result: due to the integration of the toolset download into the “pom.xml” the toolset will be automatically downloaded when changing the CaptainCasa version number “cc.version”.

JEE <==> Jakarta

Please pay attention: as with all artifacts of CaptainCasa there are two versions:

            <groupId>org.eclnt</groupId>

            <artifactId>eclnteditor_springboot</artifactId>

 

            <groupId>org.eclnt</groupId>

            <artifactId>eclnteditor_springboot_jakarta</artifactId>

 

Configuring the startup of the CaptainCasa Toolset

The CaptainCasa Toolset itself stores some configuration data:

By default the toolset will store its configuration data within the default user-directory of the operating system. In Windows this is “c:\Users\<userName>\cceditor”. But you can explicitly define the location of this directory:

java -jar eclnteditor_springboot-<version>.war configDir=...directory...

 

You can pass the directory in two ways:

java -jar eclnteditor_springboot.war configDir=../cctoolsetconfig

 

By using relative directory definitions you can e.g. define the following scenario:

<project>

    ...

    cctoolset/

        eclnteditor_springboot.war

        start.bat

    cctoolsetconfig/

        ...

        ...

 

If starting the toolset from the “/cctoolset” directory, then the configuration data is stored in a relative directory accordingly.

Configuring the CaptainCasa Toolset

Compare to the “default” installation (“setup.exe”/”.tar”) there is only one issue that needs to be defined: the location of the directory into which applications are deployed by default.

This configuration can be done in the toolset itself:

Example:

<config>

    <defaultdeployment

        webappsdir="C:\EnterpriseClientRISC\server\tomcat\webapps"

        port="50000"

    />

</config>

 

Flexible definition of projects

When creating a project of when importing a project into the toolset then one configuration file will be created in the “/projects” directory of the configuration directory.

Example: after creating project “test” there will be the following file:

<tooolConfigDirectory>

    projects/

        test.xml

 

The content of the file is simple – it just contains the location of the project:

<project projectdirectory="c:/projects/test"

         projectfilestoredinprojectdirectory="true">

</project>

 

In team scenarios you do not want the location of the project directory to be defined in a more general way.

As with any other configuration file within CaptainCasa you can access system and environment properties by using “${sys.*}” and “{env.*}” definitions. Example:

<project projectdirectory="${sys.user.dir}/.."

         projectfilestoredinprojectdirectory="true">

</project>

 

In the example the toolset will read the project from a directory that is positioned relatively to the toolset directory (“user.dir” points to the directory in which “java” was s started).