A module repository is a module that bundles a set of modules in a portable ZIP file.
It is a tree structure where modules organizations and names are mapped to folders.
A module repository takes its input modules from other repositories, usually the MicroEJ Central Repository
which is itself built by MicroEJ Corp. as a module repository.
A module repository is often called an offline repository as it includes the settings file for a local configuration in MicroEJ SDK.
It can also be imported in MicroEJ Forge.
In the SDK, first create a new module project using the artifact-repository skeleton.
The ivysettings.xmlsettings file describes how to import the modules of this repository when it is extracted locally on file system.
This file will be packaged at the root of the zip file and does not need to be modified.
The module.ivy file describes how to build repository and lists the module dependencies that will be included in this repository.
MicroEJ Module Manager (MMM) needs to import dependencies to build the module repository.
The location fetched by MMM is defined by a resolver.
The resolver is configured with the parameter bar.populate.from.resolver. The preset value is the resolver
provided by default in MicroEJ SDK configuration, which is connected to MicroEJ Central Repository.
The module repository consistency check consists in verifying that each declared module can be imported using the settings file provided by the repository.
Especially, it ensures that all module transitive dependencies are also available.
It is enabled by default to avoid further issues for repository users such as Unresolved Dependency. This is done by the following option:
We recommended to manually describe each dependency of the module repository, in order to keep full control
of the included modules as well as included modules versions.
Module dependencies can still be transitively included by setting the dependency attribute transitive to true.
In this case, the included module versions are those that have been resolved when the module was built.
Multiple versions of the same module can be included by declaring each dependency using a different configuration.
The artifacts configuration has to be derived with a new name as many times as there are different versions to include.
<configurationsdefaultconfmapping="default->default;provided->provided"><confname="artifacts"visibility="private"/><confname="artifacts_1"visibility="private"/><confname="artifacts_2"visibility="private"/><!-- ... other configurations ... --></configurations><dependencies><dependencyconf="artifacts->*"transitive="false"org="[module_org]"name="[module_name]"rev="[module_version_1]"/><dependencyconf="artifacts_1->*"transitive="false"org="[module_org]"name="[module_name]"rev="[module_version_2]"/><dependencyconf="artifacts_2->*"transitive="false"org="[module_org]"name="[module_name]"rev="[module_version_3]"/><!-- ... other dependencies ... --></dependencies>
To add all the modules already included in an other module repository,
add the configuration repository if it does not exist:
<configurationsdefaultconfmapping="default->default;provided->provided"><!-- ... other configurations ... --><confname="repository"visibility="private"description="Repository to be embedded in the repository"/></configurations>
Then declare the module repository dependency using the repository
configuration:
<dependencies><dependencyconf="repository->*"transitive="false"org="[repository_org]"name="[repository_name]"rev="[repository_version]"/><!-- ... other dependencies ... --></dependencies>
An overall Javadoc can be generated beside the included modules. It is built from of all Java elements of all libraries included in the module repository.
Javadoc generation is disabled in the module.ivy generated by the skeleton.
To enable javadoc generation, remove skip.javadoc option or set it to false.
There are also javadoc specific options such as Java packages exclusion. Please refer to *javadoc* options of Module Repository reference documentation.
In the Package Explorer, right-click on the repository project and select BuildModule.
The build consists of two steps:
Gathers all module dependencies. The whole repository content is created
under target~/mergedArtifactsRepository folder.
Checks the repository consistency. For each module, it tries to import it from this repository
and fails the build if at least one of the dependencies cannot be resolved.
The module repository .zip file is built in the target~/artifacts/ folder.
This file may be published along with a CHANGELOG.md, LICENSE.txt and README.md.