Step 1: Create a Project

$ axelor --new axelor-demo

A new application project, axelor-demo will be created under the current directory.

The Axelor Open Platform uses Gradle to manage project and it’s modules. The directory structure of a typical Axelor Open Platform application project is something like this:

axelor-demo
├── build.gradle (1)
├── gradle
│   ├── adk.gradle (2)
│   └── wrapper
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradlew (3)
├── gradlew.bat
├── settings.gradle (4)
└── src
    ├── license
    │   └── header.txt (5)
    └── main
        └── resources
            ├── application.properties (6)
            ├── log4j.properties
            └── META-INF
                └── persistence.xml
1 The gradle build script
2 The script provides common settings required for adk apps
3 The gradle wrapper script for Linux & Mac (.bat is for windows)
4 The gradle settings script
5 The license header for the source code
6 The application config file

The modules directory contains the application specific custom modules. We’ll see about modules in next step.

Let’s check the generated gradle build scripts:

build.gradle
buildscript {
    apply from: "gradle/adk.gradle" (1)
    dependencies {
        classpath adkPlugins() (2)
    }
}

apply plugin: 'axelor-app' (3)

application { (4)

    name "axelor-demo"
    title "Axelor demo"

    version "1.0.0"

    // module dependencies
    // module "modules:axelor-contact" (5)
}

license { (6)
    ext.product = "axelor-demo"
    ext.owner = "My Company"
    ext.website = "http://my-company.com"
}

tomcat { (7)
    httpPort = project.properties.get("http.port", 8080) as Integer
    stopPort = 9451
}
1 Apply common settings required for adk apps
2 Use adk gradle plugins
3 The gradle plugin for the application project, it also applies other plugins like java, groovy and war plugins.
4 The application project configuration
5 The modules this application depends on
6 The license header configuration, see the license/header.txt template.
7 The embedded tomcat server settings

Let’s understand build script.

The apply plugin: 'axelor-app' tells gradle to use a gradle plugin for this build script. This plugin defines an extension point application where we can define various properties.

  • name - name of the application

  • title - display title for the application

  • version - application version

The license settings are used to configure the license header to be placed on source files. The tomcat settings are used to configure the embedded tomcat server.

Another important build script is the settings.gradle which aggregates all the module projects to be used in current build process:

settings.gradle
// Include modules
// include "modules:axelor-contact"

The include "modules:axelor-contact" line tells gradle to include the module axelor-contact in current build cycle. It’s required to list all the modules in settings.gradle file.

The application project generally doesn’t provide any implementation logic. The functionalities should be provided by creating modules.

To check whether application project is configured properly, issue the following command:

$ ./gradlew build

or

$ axelor build

The build process should finish without any error.