Develop an environment-aware Maven build process

Extend Maven builds to port Java apps to multiple environments

1 2 3 4 5 Page 2
Page 2 of 5

Listing 2 shows the pom.xml for the Database application.

Listing 2. Database application pom.xml

<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>
    <groupId>com.foo</groupId>
    <artifactId>database</artifactId>
    <packaging>jar</packaging>
    <name>database</name>
    <version>1.0-SNAPSHOT</version>
    <description>
        Contains code to connect to MS SQL Server database.</
        description>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.3.2</version>
                </plugin>
            </plugins>
        </build>
</project>

Figure 3 shows the Database application's Maven project project directory structure as viewed in Eclipse Indigo.

Figure 3. Database application directory structure

Listing 3 shows the pom.xml for the SOAP Web Service Client application.

Listing 3. Web Service Client application pom.xml

<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>
    <groupId>com.foo</groupId>
    <artifactId>web-service-client</artifactId>
    <packaging>jar</packaging>
    <name>web-service-client</name>
    <version>1.0-SNAPSHOT</version>
    <description>Contains code to connect to a SOAP Web service.</description>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
            </plugin>
        </plugins>
    </build>
</project>


1 2 3 4 5 Page 2
Page 2 of 5