Skip to content

Etendo Jars

Overview

The new version of Etendo comes with a new plugin which is focused on JARs.

A JAR (Java ARchive) is a packaged file format containing compiled classes, metadata information and resources for a Java application in a single file.

A JAR file provides multiple benefits:

  • Security
  • Portability
  • Compression
  • Packaging
  • Distribution

One common case of JAR uses are libraries.

With Gradle you can make use of libraries to incorporate new functionality to your application.

Using the 'implementation' configuration provided by gradle you can define multiple dependencies:

implementation 'groupId:artifactId:version'

For example, to make use of the Javax email library you need to define the next block of code in the gradle build file.

dependencies {
    // https://mvnrepository.com/artifact/javax.mail/mail
    implementation group: 'javax.mail', name: 'mail', version: '1.4.7'
}

The Etendo plugin tries to use this approach, managing all libraries and dependencies that you need to run your Etendo environment.


Etendo JAR Modules

Modules are an important aspect of Etendo, they let you create and introduce new functionality to your application.

To acquire all the benefits of a JAR file, the new plugin allows the user to create a JAR version of a module with all the configuration needed to be published and distributed.

Permissions

To obtain permissions to publish a new version of a module you need to run:

./gradlew registerModule -Ppkg=<package name> -Prepo=<repository rame>

This task gives you privileges to publish in the specified repository. It also executes internally the createModuleBuild task to generate the build.gradle file.

Warning

If you already have permissions to publish and the build.gradle file already exists you do not have to run this task.

The build.gradle is a file that holds all the configuration and information used when the module is published.

Modules containing a build.gradle file are now recognized as Gradle subprojects, creating a multi-project build.

Info

If you only want to generate the build.gradle file you can run ./gradlew createModuleBuild -Ppkg=<package name> -Prepo=<repository rame> This command will overwrite the build.gradle file if is already present.

Publishing

To publish a new version of a module you need to run

./gradlew publishVersion -Ppkg=<package name> -Prepo=<repository rame>

This task creates the JAR and ZIP version of the module, and tries to publish it in the specified repository.

Info

The module needs to be compiled before published. You have to be working in a compiled environment with all the autogenerated entities created.

Info

For more information refer to the How to Publish Modules to a GitHub Repository guide


JAR File Structure

Etendo JARs modules contains a special structure. All content of the src dir will be contained in the root of the JAR, with the compiled java classes. Others directories like src-db, src-util etc, will be stored in the 'META-INF/etendo' location.

Using an Etendo JAR Module

To use a published version of a module in your Etendo enviroment, you need to define the dependency in the 'build.gradle' file of the root project.

Just like a library, using the implementation configuration:

implementation 'moduleGroupId:moduleArtifactId:moduleVersion'

The Etendo plugin will try automatically to resolve the artifact. If the dependency is a Etendo module, it will be located in the 'build/etendo/modules' directory.

The 'build/etendo/modules' directory is a new special location. Etendo development tasks now will use this place as a new modules location to search.

Etendo Core JAR

With the new version of Etendo, you can still work with the code in sources or the new JAR format.

The new Etendo core JAR contains a structure similar to JAR modules.

To make use of the Etendo core JAR, same as a library, you need to define the dependency in the build.gradle of the root project

dependencies {
  implementation group: 'com.etendoerp.platform', name: 'etendo-core', version: '22.1.0'
}

Once the artifact is resolved, the Etendo plugin will identify that the dependency is the Etendo core, and will be located in the 'build/etendo' directory.

A config directory will be created in the root project. This directory contains the configurations templates used by Etendo to run the application.

You need to set your own configurations using a gradle.properties file and run:

./gradlew setup

Once the configurations files are created, you can install the application.

./gradlew install

All the Etendo development tasks used with the core in sources should still be working with JARs.

Info

Etendo Core, (Sources and Jar), allows the user to work with modules in both formats.