Dependencies Configurations
This chapter describes all the dependency configurations added to your project by the MicroEJ Gradle plugins.
Note
The MicroEJ Gradle plugins extend the Gradle Java and Java Library plugins. For more information about the configurations inherited from those plugins, refer to the official documentation :
The following graph describes the dependency configurations. Use this legend to interpret the colors:
Green background : Dependencies can be declared against this configuration
Gray background : This configuration is for consumption by tasks only
Blue background : A task
![digraph mygraph {
rankdir="BT";
bgcolor="transparent"
fontname="Helvetica,Arial,sans-serif"
node [
shape = box
width = 1.5
color = "#7dc5dc"
style = filled
fontname="Helvetica,Arial,sans-serif"
]
edge [fontname="Helvetica,Arial,sans-serif"]
"microejVee" [fillcolor = "#41f753"]
"microejApplication" [fillcolor = "#41f753"]
"microejTool" [fillcolor = "#41f753"]
"microejRuntimeEnvironment" [fillcolor = "#41f753"]
"microejApplicationClasspath" [fillcolor = "#b0d6d3"]
"microejVeeClasspath" [fillcolor = "#b0d6d3"]
"microejKernelExecutableClasspath" [fillcolor = "#b0d6d3"]
"virtualDeviceToolClasspath" [fillcolor = "#b0d6d3"]
"microejRuntimeEnvironmentCompileClasspath" [fillcolor = "#b0d6d3"]
"microejRuntimeEnvironmentRuntimeClasspath" [fillcolor = "#b0d6d3"]
"loadVee" -> "microejVeeClasspath" [ label="uses" ]
"microejVeeClasspath" -> "microejVee"
"loadKernelExecutable" -> "microejKernelExecutableClasspath" [ label="uses" ]
"microejKernelExecutableClasspath" -> "microejVee"
"buildVirtualDevice" -> "microejApplicationClasspath" [ label="uses" ]
"buildVirtualDevice" -> "virtualDeviceToolClasspath" [ label="uses" ]
"microejApplicationClasspath" -> "microejApplication"
"virtualDeviceToolClasspath" -> "microejTool"
"microejRuntimeEnvironmentCompileClasspath" -> "microejRuntimeEnvironment"
"microejRuntimeEnvironmentRuntimeClasspath" -> "microejRuntimeEnvironment"
"compileJava" -> "microejRuntimeEnvironmentCompileClasspath" [ label="uses" ]
"compileTestJava" -> "microejRuntimeEnvironmentCompileClasspath" [ label="uses" ]
"javadoc" -> "microejRuntimeEnvironmentCompileClasspath" [ label="uses" ]
"buildVirtualDevice" -> "microejRuntimeEnvironmentRuntimeClasspath" [ label="uses" ]
"buildApplicationObjectFile" -> "microejRuntimeEnvironmentRuntimeClasspath" [ label="uses" ]
"buildExecutable" -> "microejRuntimeEnvironmentRuntimeClasspath" [ label="uses" ]
}](../../_images/graphviz-1bdf175fc7c49e136a059947dc8be1ddbef2c810.png)
The MicroEJ Gradle plugins also define dependency configurations for internal use:
antScriptLauncherClasspath
, used by the buildVirtualDevice task
addonProcessorClasspath
, used by the adp task
jdtCompilerClasspath
, used by the Add-On Library and Application plugins
wrapperClasspath
, used by thecompileJava
task
microejRuntimeEnvironmentFullRuntimeClasspath
, used by the buildVirtualDevice, buildApplicationObjectFile and buildExecutable tasks
microejVeeFullClasspath
, used by the loadVee task
Dependencies Configurations in a VEE Port Project
This section describes all the dependency configurations added to your VEE Port project by the MicroEJ Gradle plugins.
The following graph describes the dependency configurations. Use this legend to interpret the colors:
Green background: Dependencies can be declared against this configuration
Gray background: This configuration is for consumption by tasks only
Blue background: The tasks
![digraph mygraph {
rankdir="BT";
bgcolor="transparent"
fontname="Helvetica,Arial,sans-serif"
node [
shape = box
width = 1.5
color = "#7dc5dc"
style = filled
fontname="Helvetica,Arial,sans-serif"
]
edge [fontname="Helvetica,Arial,sans-serif"]
"microejArchitecture" [fillcolor = "#41f753"]
"microejPack" [fillcolor = "#41f753"]
"microejMock" [fillcolor = "#41f753"]
"microejFrontPanel" [fillcolor = "#41f753"]
"microejTool" [fillcolor = "#41f753"]
"api" [fillcolor = "#41f753"]
"implementation" [fillcolor = "#41f753"]
"microejArchitectureClasspath" [fillcolor = "#b0d6d3"]
"microejPackClasspath" [fillcolor = "#b0d6d3"]
"microejMockClasspath" [fillcolor = "#b0d6d3"]
"microejFrontPanelClasspath" [fillcolor = "#b0d6d3"]
"microejToolClasspath" [fillcolor = "#b0d6d3"]
"apiClasspath" [fillcolor = "#b0d6d3"]
"implementationClasspath" [fillcolor = "#b0d6d3"]
"microejArchitectureClasspath" -> "microejArchitecture"
"microejPackClasspath" -> "microejPack"
"microejMockClasspath" -> "microejMock"
"microejFrontPanelClasspath" -> "microejFrontPanel"
"microejToolClasspath" -> "microejTool"
"implementation" -> "api"
"apiClasspath" -> "api"
"implementationClasspath" -> "implementation"
"buildVeePort and buildVeePortConfiguration" -> "microejArchitectureClasspath" [ label="uses" ]
"buildVeePort and buildVeePortConfiguration" -> "microejPackClasspath" [ label="uses" ]
"buildVeePort and buildVeePortConfiguration" -> "microejMockClasspath" [ label="uses" ]
"buildVeePort and buildVeePortConfiguration" -> "microejFrontPanelClasspath" [ label="uses" ]
"buildVeePort and buildVeePortConfiguration" -> "microejToolClasspath" [ label="uses" ]
"buildVeePort and buildVeePortConfiguration" -> "apiClasspath" [ label="uses" ]
"buildVeePort and buildVeePortConfiguration" -> "implementationClasspath" [ label="uses" ]
}](../../_images/graphviz-e56694c1710b54658c292aba89f86796edb379c5.png)
Variants
The MicroEJ Gradle plugins define a list of variants allowing to fetch the right component of a dependency based on the consumer’s requirements. Each variant is configured with its own attributes. Refer to Attributes of a Variant for more information about attributes.
Add-On Library
The Add-On Library plugin defines the following variants:
runtimeAndMockElements
This variant is used to fetch a Library and its dependencies when it is declared with the implementation
or api
configuration in your VEE Port project.
It is configured with the following attribute:
the custom
com.microej.veeport.artifact.usage
attribute, set todefault
Application
The Application plugin defines the following variants:
microejWPK
This variant is used to fetch the WPK of an Application when a dependency is declared with the microejApplication
configuration in your project.
It is configured with the following attributes:
the custom
com.microej.artifact.element
attribute, set toapplication-wpk
the standard
LibraryElement
attribute, set tomicroej-wpk
microejExecutable
This variant is used to fetch the Executable of an Application when a dependency is declared with the microejVee
configuration in your project.
It is configured with the following attributes:
the custom
com.microej.artifact.element
attribute, set toexecutable
the standard
LibraryElement
attribute, set tomicroej-executable
microejExecutableBuildFiles
This variant is used to publish the files generated when building the Executable of an Application. It is configured with the following attribute:
the custom
com.microej.artifact.element
attribute, set toexecutable-build-files
microejVirtualDevice
This variant is used to fetch the Virtual Device of an Application when a dependency is declared with the microejVee
configuration in your project.
It is configured with the following attributes:
the custom
com.microej.artifact.element
attribute, set tovirtual-device
the standard
LibraryElement
attribute, set tomicroej-vee-port
microejFeatureBuildFiles
This variant is used to publish the files generated when building the Feature of an Application. It is configured with the following attribute:
the custom
com.microej.artifact.element
attribute, set tofeature-build-files
Mock
The Mock plugin defines the following variants:
microejMockRip
This variant is used to fetch the RIP of a Mock when a dependency is declared with the microejMock
configuration in your project.
It is configured with the following attributes:
the custom
com.microej.veeport.artifact.usage
attribute, set todefault
the standard
LibraryElement
attribute, set tomicroej-rip
Runtime Environment
The Runtime Environment plugin defines the following variants:
runtimeEnvironment
This variant is used to fetch the Runtime Environment Jar when a dependency is declared with the microejRuntimeEnvironment
configuration in your project.
It is configured with the following attributes:
the custom
com.microej.artifact.element
attribute, set toruntime-environment-api
the standard
LibraryElement
attribute, set tomicroej-runtime-environment
VEE Port
The VEE Port plugin defines the following variants:
microejVeePort
This variant is used to fetch the VEE Port when it is declared with the microejVee
configuration in your project.
It is configured with the following attributes:
the custom
com.microej.veeport.artifact.usage
attribute, set todefault
the standard
LibraryElement
attribute, set tomicroej-vee-port
Attributes of a Variant
An attribute allows Gradle to select the right variant depending on the consumer’s requirements. They are two types of attributes: standard attributes and custom attributes.
Standard Attributes
The standard attributes are defined by Gradle. Such an attribute is mandatory so the resolution of a dependency will fail if
the producer did not define a variant with the attribute set to the same value.
For example, if a VEE Port is defined using the implementation
configuration, the build fails because the consumer wants a Jar but
the VEE Port defines the LibraryElement
attribute to microej-vee-port
:
> Could not resolve all files for configuration ':runtimeClasspath'.
> Could not resolve com.mycompany:myVeePort:1.0.0.
Required by:
root project :
> No matching variant of com.mycompany:myVeePort:1.0.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- Variant 'microejVeePort' declares a library for use during runtime, compatible with Java 7, and its dependencies bundled (fat jar):
- Incompatible because this component declares a component, with the library elements 'microej-vee-port' and the consumer needed a component, packaged as a jar
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
If no variant matches the consumer’s requirements, Gradle can select a compatible variant. To make a variant compatible, the consumer must define a compatibility rule.
For example, this is the case for the Mocks built with SDK 6 1.1.0
or below that are published with the LibraryElement
attribute set to microej-rip
.
To build a VEE Port from an Application, a compatibility rule is required to ensure that the fetch of the VEE Port and its dependencies other than Mocks does not fail.
Custom Attributes
The custom attributes are defined by the user. These attributes are optional, so when resolving a dependency Gradle selects the default variant of the dependency if the producer did not define a variant with the attribute set to the same value.
For example, this is the case for the Mocks built with SDK 6 1.2.0
or higher that are published with the custom com.microej.veeport.artifact.usage
attribute. This attribute is optional,
so when building a VEE Port from an Application, the VEE Port and all its dependencies other than Mocks are correctly fetched without having to define a compatiblity rule.
Warning
Starting from SDK 6 1.3.0
, both a custom attribute and a standard attribute are used when resolving a MicroEJ dependency.
The standard attribute is still defined to ensure that modules built with SDK 6 1.2.0
and below can be fetched by projects built with SDK 6 1.3.0
or higher.
However, this attribute will be removed in the next major version, so it is highly recommended to update your project to use latest SDK 6 plugins.
For more information about variants and attributes, refer to the official documentation.