Since JavaEE 7 is brand new TomEE is still JavaEE 6 but you can want to add to TomEE some JavaEE 7 features either upgrading some libraries (like BVal which has a Bean Validation 1.1 branch) or replacing some implementation by another one.
Replacing the implementation is generally easy since you can add it either in your application or in the container through <libs> tag of tomee-maven-plugin BUT here you also need to replace the API (= upgrading the JavaEE 6 provided one to a JavaEE 7 one).
TomEE is coming with a bundle API jar (javaee-api) so how to do so?
It fact it is pretty trivial, when we built the bundle jar we built an assembly with all included jars too so you basically just need to ask the tomee-maven-plugin to remove the javaee-api jar, then to extract the assembly of geronimo spec jars. It can be done adding two lines to <libs>:
<build> <plugins> <plugin> <groupId>org.apache.openejb.maven</groupId> <artifactId>tomee-maven-plugin</artifactId> <version>1.6.0-SNAPSHOT</version> <configuration> <libs> <lib>remove:javaee-api</lib> <lib>unzip:org.apache.openejb:javaee-api:6.0-5:zip</lib> </libs> </configuration> </plugin> </plugins> </build>
Easy isn’t it? 😉
You can even go further, if you want to replace CDI API (from version 1.0 to 1.1) to use openwebbeans cdi11 module (pretty new and unstable ATM). You can of course replace the unzip line by the list of all geronimo API jars but it will be very verbose…An alternative will be to use the fact <libs> is a list and commands are executed sequentially, so just ask the plugin to remove the cdi 1.0 API after having unpacked the javaee-api zip and finally add the API you want:
<build> <plugins> <plugin> <groupId>org.apache.openejb.maven</groupId> <artifactId>tomee-maven-plugin</artifactId> <version>1.6.0-SNAPSHOT</version> <configuration> <libs> <lib>remove:javaee-api</lib> <lib>unzip:org.apache.openejb:javaee-api:6.0-5:zip</lib> <lib>remove:geronimo-jcdi_1.0_spec-1.0</lib> <lib>javax.enterprise:cdi-api:1.1</lib> </libs> </configuration> </plugin> </plugins> </build>
is it possible to remove library without the maven plugin ?
Hi, physially yes otherwise just ensure it is before other jars in common.loader (conf/catalina.properties)