MicroEJ Module Manager

Introduction

Modern electronic device design involves many parts and teams to collaborate to finally obtain a product to be sold on its market. MicroEJ encourages modular design which involves various stake holders: hardware engineers, UX designers, graphic designers, drivers/BSP engineers, software engineers, etc.

Modular design is a design technique that emphasizes separating the functionality of an application into independent, interchangeable modules. Each module contains everything necessary to execute only one aspect of the desired functionality. In order to have team members collaborate internally within their team and with other teams, MicroEJ provides a powerful modular design concept, with smart module dependencies, controlled by the MicroEJ Module Manager (MMM). MMM frees engineers from the difficult task of computing module dependencies. Engineers specify the bare minimum description of the module requirements.

The following schema introduces the main concepts detailed in this chapter.

MMM Overview

MMM Overview

MMM is based on the following tools:

Specification

MMM provides a non ambiguous semantic for dependencies resolution. Please consult the MMM specification available on https://developer.microej.com/packages/documentation/TLT-0831-SPE-MicroEJModuleManager-2.0-D.pdf.

Module Project Skeleton

In MicroEJ SDK, a new MicroEJ module project is created as following:

  • Select File > New > Project…,
  • Select MicroEJ > MicroEJ Module Project [1],
  • Fill the module information (project name, module organization, name and revision),
  • Select one of the suggested skeletons depending on the desired module nature,
  • Click on Finish.

The project is created and a set of files and directories are generated from the selected skeleton.

Note

When an empty Eclipse project already exists or when the skeleton has to be created within an existing directory, the MicroEJ module is created as following:

  • In the Package Explorer, click on the parent project or directory,
  • Select File > New > Other…,
  • Select EasyAnt > EasyAnt Skeleton.

Module Description File

A module description file is an Ivy configuration file named module.ivy, located at the root of each MicroEJ module project. It describes the module nature (also called build type) and dependencies to other modules.

<ivy-module version="2.0" xmlns:ea="http://www.easyant.org" xmlns:m="http://ant.apache.org/ivy/extra"
                          xmlns:ej="https://developer.microej.com" ej:version="2.0.0">
    <info organisation="[organisation]" module="[name]" status="integration" revision="[version]">
        <ea:build organisation="com.is2t.easyant.buildtypes" module="[buildtype_name]" revision="[buildtype_version]">
            <ea:property name="[buildoption_name]" value="[buildoption_value]"/>
        </ea:build>
    </info>

    <configurations defaultconfmapping="default->default;provided->provided">
        <conf name="default" visibility="public"/>
        <conf name="provided" visibility="public"/>
        <conf name="documentation" visibility="public"/>
        <conf name="source" visibility="public"/>
        <conf name="dist" visibility="public"/>
        <conf name="test" visibility="private"/>
    </configurations>

    <publications>
    </publications>

    <dependencies>
      <dependency org="[dep_organisation]" name="[dep_name]" rev="[dep_version]"/>
    </dependencies>
</ivy-module>

MicroEJ Module Manager Configuration

By default, when starting an empty workspace, MicroEJ SDK is configured to import dependencies from MicroEJ Central Repository and to publish built modules to a local folder. The repository configuration is stored in a settings file (ivysettings.xml), and the default one is located at $USER_HOME\.microej\microej-ivysettings-[VERSION].xml

Preferences Page

The MMM preferences page is available at Window > Preferences > MicroEJ > Module Manager [1].

MMM Preferences Page

MMM Preferences Page

This page allows to configure the following elements:

  1. Settings File: the file describing how to connect module repositories. See the settings file section.

  2. Options: files declaring MMM options. See the Options section.

  3. Use Module repository as Build repository: the settings file for connecting the build repository in place of the one bundled in MicroEJ SDK. This option shall not be enabled by default and is reserved for advanced configuration.

  4. Build repository Settings File: the settings file for connecting the build repository in place of the one bundled in MicroEJ SDK. This option is automatically initialized the first time MicroEJ SDK is launched. It shall not be modified by default and is reserved for advanced configuration.

  5. Set verbose mode: to enable advanced debug traces when building a module.

  6. Runtime JRE: the Java Runtime Environment that executes the build process.

  7. Max build history size: the maximum number of previous builds available in Build Module shortcut list:

    ../_images/mmm_shortcut_build_module.png

Settings File

The settings file is an XML file that describes how MMM connects local or online module repositories. The file format is described in Apache Ivy documentation.

To configure MMM to a custom settings file (usually from an offline repository):

  1. Set Settings file to a custom ivysettings.xml settings file [1],
  2. Click on Apply and Close button

If the workspace is not empty, it is recommended to trigger a full resolution and rebuild all the projects using this new repository configuration:

  1. Clean caches

    • In the Package Explorer, right-click on a project;
    • Select Ivy > Clean all caches.
  2. Resolve projects using the new repository

    To resolve all the workspace projects, click on the Resolve All button in the toolbar:

    ../_images/mmm_shortcut_resolveAll.png

    To only resolve a subset of the workspace projects:

    • In the Package Explorer, select the desired projects,
    • Right-click on a project and select Ivy > Clean all caches.
  3. Trigger Add-On Library processors for automatically generated source code

    • Select Project > Clean…,
    • Select Clean all projects,
    • Click on Clean button.

Options

Options can be used to parameterize a module description file or a settings file. Options are declared as key/value pairs in a standard Java properties file, and are expanded using the ${my_property} notation.

A typical usage in a settings file is for extracting repository server credentials, such as HTTP Basic access authentication:

  1. Declare options in a properties file

    ../_images/mmm_preferences_options_settings_declaration.png
  2. Register this property file to MMM options

../_images/mmm_preferences_options_settings_register.png
  1. Use this option in a settings file

    ../_images/mmm_preferences_options_settings_usage.png

A typical usage in a module description file is for factorizing dependency versions across multiple modules projects:

  1. Declare an option in a properties file

    ../_images/mmm_preferences_options_declaration.png
  2. Register this property file to MMM options

    ../_images/mmm_preferences_options_register.png
  3. Use this option in a module description file

    ../_images/mmm_preferences_options_usage.png

Build Kit

The Module Manager build kit is the consistent set of tools and scripts required for building modules.

It is bundled with MicroEJ SDK and can be exported to run in headless mode using the following steps: [1]

  • Select File > Export > MicroEJ > Module Manager Build Kit,
  • Choose an empty Target directory,
  • Click on the Finish button.

Once the build kit is fully exported, the directory content shall look like:

../_images/mmm_extract_build_kit.png

To go further with headless builds, please consult Tool-CommandLineBuild for command line builds, and this tutorial to setup MicroEJ modules build in continuous integration environments).

[1](1, 2, 3, 4) If using MicroEJ SDK versions lower than 5.2.0, please refer to the following section.

Former MicroEJ SDK Versions

This section describes MMM configuration elements for MicroEJ SDK versions lower than 5.2.0.

New MicroEJ Module Project

The New MicroEJ Module Project wizard is available at File > New > Project…, EasyAnt > EasyAnt Project.

Preferences Pages

MMM Preferences Pages are located in two dedicated pages. The following pictures show the options mapping using the same options numbers declared in Preferences Page.

Ivy Preferences Page

The Ivy Preferences Page is available at Window > Preferences > Ivy > Settings.

../_images/mmm_preferences_up_to_5.1_ivy_settings_annotated.png

Easyant Preferences Page

The Easyant Preferences Page is available at Window > Preferences > EasyAnt4Eclipse.

../_images/mmm_preferences_up_to_5.1_ea4eclipse_annotated.png

Export the Build Kit

  • Create an empty directory (e.g. mmm_sdk_[version]_build_kit),
  • Locate your SDK installation plugins directory (by default, C:\Program Files\MicroEJ\MicroEJ SDK-[version]\rcp\plugins on Windows OS),
  • Open the file com.is2t.eclipse.plugin.easyant4e_[version].jar with an archive manager,
  • Extract the directory lib to the target directory,
  • Open the file com.is2t.eclipse.plugin.easyant4e.offlinerepo_[version].jar with an archive manager,
  • Navigate to directory repositories,
  • Extract the file named microej-build-repository.zip for MicroEJ SDK 5.x or is2t_repo.zip for MicroEJ SDK 4.1.x to the target directory.