Requirements

First of all, you will need the following:

  • Java (JDK-17 or JDK-19)

  • git

Optionally you can also install:

  • Solr-9.6.x (Used for intranet-wide search bar)

  • Postgresql

Java Version

To check Java versions, type the following command:

java -fullversion
openjdk full version "17.0.5+1"

On Mac, you can install Jdk-17 via brew command:

brew install openjdk@17

Cloning the ready-to-dev Intranet

git clone https://github.com/Taack/intranet.git

This repository includes a stripped-down version of an intranet on top of which you can build more applications. It includes "Crew", the user management system, and its security dependency: Spring Security Plugin.

Start your intranet

Navigate inside the newly cloned intranet folder and start the server by executing this command:

./gradlew server:bootRun

If you want Gradle to watch app module to hot restart the server at each modification, launch the server adding the -Dgrails.run.active=true option:

./gradlew -Dgrails.run.active=true server:bootRun

After a while you should see in the console:

Grails application running at http://localhost:9442

You can now access the intranet by going to that address in your browser. You can also log in with the default credentials (username: admin; password: ChangeIt). The password can be changed in server/grails-app/conf/application.yml.

Configuring persistent Db

If you want data to be persistent, change the server/grails-app/conf/application.yml file to use a persistent database.

Here we want H2 to persist data in a file in development mode:

environments:
    development:
        dataSource:
            dbCreate: update
            url: jdbc:h2:./prodDb;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE

Producing a Jar file for Tomcat

Instead of bootRun task, use assemble task:

./gradlew server:assemble

The server jar file is produced into server/build/libs folder. You can import it in your Tomcat production server or test it with:

cd server/build/libs
java -jar server-[version].jar

It will be faster, assets will be compiled and merged.

Make sure you’re not already running the application

Set up your IDE

We highly recommend using the latest version of IntelliJ Ultimate Edition for its comprehensive support of Groovy and Grails. We are also exploring support for other IDEs such as Eclipse and Visual Studio Code, as well as considering support for IntelliJ non-Ultimate Edition.

IntelliJ Ultimate Edition

We recommend installing the IntelliJ Taack Plugin that you can install from the Intellij marketplace TaackUiASTAutocomplete or directly from the source code repository.

To open the project, select File  Open project and select intranet/server/settings.gradle.

Make sure that the JDK used with Gradle is at version 17 (or 19):

Open Gradle Settings

open settings gradle intellij

Check Gradle Jdk Version

settings gradle intellij

Visual Studio Code

If you really want to use Visual Studio Code, we recommend the following extensions to use this framework:

Keep in mind that most of the Grails and Taack Framework features will not be recognized by VSCode but are still usable. In addition, VSCode will not help you with imports, code navigation, and many QoL features will be unavailable since groovy support is not as extensive as IntelliJ.