JBoss Trading – Java EE 5 to Java EE 6 Migration Part III (Structure & Packaging)

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.

  1. Rename JBoss Trading Beans (trading-beans).
  2. pom.xml (update)
    <artifactId>trading-beans</artifactId>
    <packaging>ejb</packaging>
    
    <name>JBoss Trading Beans</name>

JBoss Trading EJB Client

  1. 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.

  1. pom.xml (update)
    <artifactId>trading-rest</artifactId>
    <packaging>jar</packaging>
  2. Remove the Maven WAR plugin configuration.
    <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.1.1</version>
        <configuration>
            <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
    </plugin>
  3. Remove the JBoss Trading Web Services dependency.
    <dependency>
        <groupId>com.jboss.trading</groupId>
        <artifactId>trading-ws</artifactId>
        <version>${project.version}</version>
    </dependency>
  4. META-INF (create)
  5. Move beans.xml from WEB-INF to META-INF.
  6. 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.

  1. 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>
  2. 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

  1. pom.xml (update)
    <dependency>
        <groupId>com.jboss.trading</groupId>
        <artifactId>trading-beans</artifactId>
        <version>${project.version}</version>
        <type>ejb</type>
    </dependency>
  2. Remove the JBoss Trading REST dependency.
    <dependency>
        <groupId>com.jboss.trading</groupId>
        <artifactId>trading-rest</artifactId>
        <version>${project.version}</version>
        <type>war</type>
    </dependency>
  3. 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).

  1. module (delete)

JBoss Trading

  1. 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)
, , ,

About Shane K Johnson

Technical Marketing Manager, Red Hat Inc.

View all posts by Shane K Johnson

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 115 other followers

%d bloggers like this: