Skip to main content
Version: Current

Simplified Project Structure

How to create a project

To create a new project with the Simplified structure, use genx with the blank-app-seed.

npx -y @genesislcap/genx@latest init <app-name>

There is a different procedure if you want to migrate a project from the Legacy structure.

Comparison to legacy structure

Below is a side-by-side comparison of an example project between the Legacy and Simplified structures. For now, we shall focus on the server part of the project.

Simplified StructureLegacy Structure

Now let's break down and see exactly where you put your files in the Simplified structure compared to the Legacy structure. For this example, let’s take our product named "position".

LegacySimplified
Project config filesposition-config/src/main/resources/cfg/position-app/src/main/genesis/cfg/
Project script filesposition-script-config/src/main/resources/cfg/position-app/src/main/genesis/scripts/
Site-specific config filesposition-site-specific/src/main/resources/cfg/position-app/src/main/genesis/cfg/
Site-specific script filesposition-site-specific/src/main/resources/scripts/position-app/src/main/genesis/scripts/
Other site-specific filesposition-site-specific/src/main/resources/position-app/src/main/genesis/

As you will see from above, all config and script files are contained in the folder position-app/src/main/genesis.

Where did the other modules go?

In the Simplified structure, some modules have been removed completely. Others are now managed by the Settings plugin. We call these "internal modules".

The internal modules are located in the root project’s (server) build folder build/internal-modules. Do not amend the files inside those modules.

Module nameWhere has it gone?
-dictionary-cacheHidden internal module. Contains generated code.
-distributionRemoved. The project’s distribution file will be located in the root project’s (server) build folder, server/build/distributions.
-site-specificRemoved. Application projects will have a site-specific distribution file created, which will be located in the root project's (server) build folder, server/build/distributions. Non-project config and script files will be included in the distribution. All folders and files in the main module's src/main/genesis folder, (except cfg and scripts) will also be included.
-eventhandlerRemoved.
-messagesRemoved.
-configRemoved. A -config.jar will be built from the main module and will contain your project's config and script files. It will be in the main module build/libs folder.
-script-configRemoved.
-deployRemoved. The deploy plugin can optionally be enabled on the main module.

Migrating from the Legacy structure

Below are the steps required to migrate from the Legacy structure to the Simplified structure.

  1. Add Settings plugin.
  2. Remove any of the plugins that will be added automatically by the Settings plugin from your root project's build.gradle.kts and settings.gradle.kts files.
  3. Remove the dependency on genesis-bom in your root project's build.gradle.kts file.
  4. Create your main module and include it in your root project's settings.gradle.kts file.
  5. Move the following files:
FromTo
{productName}-config/src/main/resources/cfg/{mainModule}/src/main/genesis/cfg/
{productName}-script-config/src/main/resources/cfg/{mainModule}/src/main/genesis/scripts/
{productName}-site-specific/src/main/resources/cfg/{mainModule}/src/main/genesis/cfg/
{productName}-site-specific/src/main/resources/scripts/{mainModule}/src/main/genesis/scripts/
All other {productName}-site-specific files{mainModule}/src/main/genesis (see here for more details)
  1. Delete the following modules and delete them from the root project's settings.gradle.kts:
  • {productName}-dictionary-cache
  • {productName}-deploy
  • {productName}-distribution
  • {productName}-config
  • {productName}-script-config
  • {productName}-site-specific (if present)
  1. Set the project type
  2. Add any PBC project dependencies.

Adding new modules to a simple project

Although now it is possible to have all your application code in a single module, you might still want to extract parts of the code for easier maintenance.

To add a new module:

  1. Create a sub-directory in the /server directory.
  2. Add source directories as required (/main/java, src/main/kotlin, /src/main/resources)
  3. Create a build.gradle.kts file:
dependencies {

}

description = "myapp-newmodule"
  1. Add any required dependencies for this module inside the dependencies block in the file above. If you want to depend on the code that is generated from your main app module, add the following:
dependencies {
genesisGeneratedCode(withTestDependency = true)
}
  1. Add an include for the new module in /server/settings.gradle.kts:
include("myapp-newmodule")