This post is the third in a series that covers the Java EE 5 to Java EE 6 migration of the JBoss Trading application (link).
This post covers the final configuration modifications required for the packaging covered in Part II (JAX-WS 2.2 & JPA 2.0).
Packaging
This is how the Java EE 6 version of the JBoss Trading application (link) is packaged.
- JBoss Trading App (EAR)
- JBoss Trading Beans (EJB JAR)
- JBoss Trading Web (WAR)
- JBoss Trading REST (JAR)
- JBoss Trading Web Services (JAR)
Configuration
JBoss Trading Services
This module will be renamed as is it no longer contains JAX-RS and JAX-WS services.
- Rename JBoss Trading Beans (trading-beans).
- pom.xml (update)
<artifactId>trading-beans</artifactId> <packaging>ejb</packaging> <name>JBoss Trading Beans</name>
JBoss Trading EJB Client
- pom.xml (update)
<dependency> <groupId>com.jboss.trading</groupId> <artifactId>trading-beans</artifactId> <version>${project.version}</version> <type>ejb-client</type> </dependency>
JBoss Trading REST
The JAX-RS services are packaged as a JAR, and are a dependency of the new JBoss Trading Web module.
- pom.xml (update)
<artifactId>trading-rest</artifactId> <packaging>jar</packaging>
- Remove the Maven WAR plugin configuration.
<plugin> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> - Remove the JBoss Trading Web Services dependency.
<dependency> <groupId>com.jboss.trading</groupId> <artifactId>trading-ws</artifactId> <version>${project.version}</version> </dependency> - META-INF (create)
- Move beans.xml from WEB-INF to META-INF.
- webapp (delete)
JBoss Trading Web
A new module for exposing the JAX-RS services and the JAX-WS services. The version number will not be included in the file names of the WAR libraries.
- pom.xml (create)
<?xml version="1.0"?> <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.jboss.trading</groupId> <artifactId>trading-parent</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../trading-parent/pom.xml</relativePath> </parent> <artifactId>trading-web</artifactId> <packaging>war</packaging> <name>JBoss Trading Web</name> <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> <outputFileNameMapping>@{artifactId}@.@{extension}@</outputFileNameMapping> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>com.jboss.trading</groupId> <artifactId>trading-api</artifactId> <version>${project.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.jboss.trading</groupId> <artifactId>trading-rest</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>com.jboss.trading</groupId> <artifactId>trading-ws</artifactId> <version>${project.version}</version> </dependency> </dependencies> </project> - webapp/WEB-INF/beans.xml (create)
<?xml version="1.0"?> <beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://jboss.org/schema/cdi/beans_1_0.xsd" />
JBoss Trading App
- pom.xml (update)
<dependency> <groupId>com.jboss.trading</groupId> <artifactId>trading-beans</artifactId> <version>${project.version}</version> <type>ejb</type> </dependency> - Remove the JBoss Trading REST dependency.
<dependency> <groupId>com.jboss.trading</groupId> <artifactId>trading-rest</artifactId> <version>${project.version}</version> <type>war</type> </dependency> - Add the JBoss Trading Web dependency.
<dependency> <groupId>com.jboss.trading</groupId> <artifactId>trading-web</artifactId> <version>${project.version}</version> <type>war</type> </dependency>
JBoss Trading RESTEasy JAX-RS
No longer required. See Part I (CDI 1.0 & JAX-RS 1.1).
- module (delete)
JBoss Trading
- pom.xml (update)
<modules> <module>trading-api</module> <module>trading-app</module> <module>trading-client-test-dist</module> <module>trading-client-test-perf</module> <module>trading-beans</module> <module>trading-ejb-client</module> <module>trading-ejb-client-test-config</module> <module>trading-parent</module> <module>trading-rest</module> <module>trading-rest-client</module> <module>trading-rest-client-test-config</module><module>trading-resteasy-jaxrs</module><module>trading-services</module><module>trading-test</module> <module>trading-test-config</module> <module>trading-web</module> <module>trading-ws</module> <module>trading-ws-client</module> <module>trading-ws-client-test-config</module> </modules>
Build
mvn clean package -Plocalhost-remote -DskipTests
JBoss Trading – Java EE 5 to Java EE 6 Migration
- Part I – CDI 1.0 & JAX-RS 1.1 (link)
- Part II – JPA 2.0 & JAX-WS 2.2 (link)
- Part III – Structure & Packaging
- Part IV – Deployment & Testing (link)
- Part V – Clean Up (link)