MicroProfile 2.2 just has been released with updates to the Fault Tolerance, Open Tracing, Open API, and Rest Client APIs. Whatβs also supported since version 2.2 is the usage of BOM (bill of material) dependency imports.
With that approach we can define the MicroProfile version in the dependencyManagement block and use only the desired MicroProfile projects. You use the MicroProfile version thatβs supported by your runtime and will get the correct versions of all corresponding MicroProfile projects. This is also useful in the combination with Java EE.
See the following example Maven POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.sebastian-daschner</groupId> <artifactId>bom-test</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <dependencyManagement> <dependencies> <dependency> <groupId>org.eclipse.microprofile</groupId> <artifactId>microprofile</artifactId> <version>2.2</version> <scope>import</scope> <type>pom</type> </dependency> </dependencies> </dependencyManagement> <dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>8.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.eclipse.microprofile.config</groupId> <artifactId>microprofile-config-api</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.eclipse.microprofile.fault-tolerance</groupId> <artifactId>microprofile-fault-tolerance-api</artifactId> <scope>provided</scope> </dependency> </dependencies> <build> <finalName>bom-test</finalName> </build> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <failOnMissingWebXml>false</failOnMissingWebXml> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> </project>
This builds a thin deployment artifact that only ships the compiled classes. The project sources are compiled against the Java EE 8 API, the MicroProfile Config 1.3 and Fault Tolerance 2.0 APIs.
Published on Java Code Geeks with permission by Sebastian Daschner, partner at our JCG program. See the original article here: MicroProfile 2.2 BOM import support Opinions expressed by Java Code Geeks contributors are their own. |
Thank you!
We will contact you soon.
Sebastian DaschnerFebruary 14th, 2019Last Updated: February 13th, 2019

This site uses Akismet to reduce spam. Learn how your comment data is processed.