If em-maven-extension
is added to the project like this:
<build>
<extensions>
<extension>
<groupId>com.commsen.em</groupId>
<artifactId>em-maven-extension</artifactId>
<version>${em.version}</version>
</extension>
</extensions>
</build>
then the EccentricModularityMavenLifecycleParticipant
is executed.
For each project in the reactor EccentricModularityMavenLifecycleParticipant
calls EccentricModularityExecutionListener
which does the following:
- checks for and warns of old properties (there was properties syntax change at some point)
- If SNAPSHOT version of
Bnd
is used it addsBnd
's snapshot repository to the list of remote repositories so Maven can download needed artifacts. - It dynamically adds
em-maven-plugin:link
plugin goal topackage
phase. Here is what it does when it is executed later on. - If
<em:module />
property is found in the POM:- adds
em-maven-plugin:registerContract
plugin goal topackage
phase. Here is what it does when it is executed later on. - configures
bnd-maven-plugin
and dynamically adds it to the POM. When executed during thepackage
phase this plugin generates OSGi metadata in the resulting jar file. For more information see https://github.com/bndtools/bnd/tree/master/maven/bnd-maven-plugin
- adds
- If
<em:augment />
property is found in the POM:- TODO
- If project's packaging in
index
- TODO
- If
<em:resolve />
property is found in the POM:- If the property has value it is treated as target runtime and "distro jar" (matadata only) for it is created in EM's home of the project.
- adds
em-maven-plugin:registerContract
plugin goal topackage
phase. Here is what it does when it is executed later on. - configures
em-maven-plugin:resolve
and dynamically adds it to the POM. When executed during thepackage
phase this plugin resolves what modles are needed and then places the respective jar files in the target folder - indexer
- configures
bnd-maven-plugin
and dynamically adds it to the POM. When executed during thepackage
phase this plugin generates OSGi metadata in the resulting jar file. For more information see https://github.com/bndtools/bnd/tree/master/maven/bnd-maven-plugin
- If
<em:executable />
property is found in the POM:- TODO
The goal is executed during package
stage for all modules (maven projects) that are part of the build.
- It copies the resulting jar file to project's
EM_HOME
(by default that is~/.em/<GROUP_ID>/<ARTIFACT_ID>/<VERSION>/<JAR_FILE_NAME>
) - It updates EM's local database creating a mapping between
- the exact location of the jar file in the project's target folder
- the exact location of the jar file in Maven'l local repo (the
~/.m2/repository/...
) - the exact location of the jar file in EM's home folder
The goal is executed during package
stage for all modules (maven projects) that are part of the build and have one of the following properties:
<em:module />
<em:resolve />
<em:executable />
It inspects the resulting jar file for capabilities in the em.contract
namespace. If such capabilities are found they are saved in EM's local database.
- A
bnd
instructions are generated from this freemarker template where:includePackages
is taken "as is" from<em:module.includePackages />
POM propertyimportStatement
is calculated based on<em:module.importPackages />
and<em:module.ignorePackages />
POM properties.
- The generated instructions are added to the
bnd-maven-plugin
's configuration and the plugin is dynamically added to the POM - The
maven-compiler-plugin
is dynamically reconfigured to addem.annotation.processors
to it'sannotationProcessorPaths
. Here is what they do when executed duringcompile
phase. - The
maven-jar-plugin
is dynamically reconfigured to use theMANIFEST.MF
generated bybnd-maven-plugin
- add "
Provide-Capability: ...
" to generated bnd file for modules having classes annotated with@Provides
or custom annotations meta-annotated with@Provides
- add "
Require-Capability: ...
" to generated bnd file for modules having classes annotated with@Requires
or custom annotations meta-annotated with@Requires
- add "
Fragment-Host: system.bundle; extension:=framework
" to generated bnd file for modules having class annotated with@RuntimeExtension
- add "
Fragment-Host: system.bundle; extension:=bootclasspath
" to generated bnd file for modules having class annotated with@RuntimeExtension(Type.BOOTCLASSPATH)
- add "
Bundle-Activator: ...
" to generated bnd file for modules having classes annotated with@Activator
- add "
ExtensionBundle-Activator: ...
" to generated bnd file for modules having classes annotated with@Activator(extension=true)
The plugin configuration is generated from this freemarker template where:
bundlesOnly
istrue
if the goal was added by<em:resolve />
andfalse
if the goal was added by<em:executable />
bndrun
is the file to be used by the bnd's resolve/export process:- If the file is provided in
<em:config.bndrunFile>
property and it exists and it's a file, this file is used. - If there is no file specified, it is generated from this freemarker template where:
requirements
is a list of generated contract requirements containing- the module itself
- the contracts provided in
<em:contracts>
POM property
runProperties
contains the runtime properties specified in<em:executable.properties>
POM propertydistro
is the "distro jar" (matadata only) generated from the provided target environment if specified.
- If the file is provided in
This mojo extends the bnd-export-maven-plugin mojo and does the following: