Deploy Ear to WAS

In this sample we will show how to deploy application 'simple-ear.ear' to the WebSphere Application server during the install phase. We will show how to:

  • customize some of the properties and configure embedded web module simple-webapp.war
  • do typical WAS configuration by inverting classloaderMode to PARENT_LAST
  • configure session invalidation timeout for a specific module
    ...
        <properties>
            <deployit.username>admin</deployit.username>
            <deployit.password>admin</deployit.password>
            <deployit.server>localhost</deployit.server>
            <deployit.port>4516</deployit.port>
            <deployit.container>Environments/was85sa</deployit.container>
        </properties>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>com.xebialabs.deployit</groupId>
                    <artifactId>maven-deployit-plugin</artifactId>
                    <version>4.5.1</version>
                    <extensions>true</extensions>
    
                    <executions>
                        <execution>
                            <id>deployit-generate-package</id>
                            <phase>package</phase>
                            <goals>
                                <goal>generate-deployment-package</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>deployit-plugin-deploy</id>
                            <phase>install</phase>
                            <goals>
                                <goal>deploy</goal>
                            </goals>
                            <configuration>
                                <environmentId>${deployit.container}</environmentId>
                            </configuration>
                        </execution>
                    </executions>
    
                    <configuration>
                        <username>${deployit.username}</username>
                        <password>${deployit.password}</password>
                        <serverAddress>${deployit.server}</serverAddress>
                        <port>${deployit.port}</port>
                        <deletePreviouslyDeployedDar>true</deletePreviouslyDeployedDar>
                        <timestampedVersion>false</timestampedVersion>
                        <cancelTaskOnError>false</cancelTaskOnError>
                        <environmentId>${deployit.container}</environmentId>
    
                        <deploymentPackageProperties>
                            <createDate>2014-05-23</createDate>
                        </deploymentPackageProperties>
                        <deployables>
                            <was.Ear name="SimpleWeatherAppEar" groupId="org.sonatype.mavenbook.multi" artifactId="simple-ear">
                                <preCompileJsps>false</preCompileJsps>
                                <jdkSourceLevel>15</jdkSourceLevel>
                                <webModules>
                                    <was.EmbeddedWebModuleSpec name="simple-ear/simple-webapp.war">
                                        <contextRoot>/simpleweather</contextRoot>
                                        <startingWeight>17</startingWeight>
                                        <classloaderMode>PARENT_LAST</classloaderMode>
                                        <virtualHostName>default_host</virtualHostName>
                                        <preCompileJsps>true</preCompileJsps>
                                        <jdkSourceLevel>16</jdkSourceLevel>
                                        <sessionManagers>
                                            <was.SessionManagerSpec name="simple-ear/simple-webapp.war/SessionManager">
                                                <TuningParams_invalidationTimeout>66</TuningParams_invalidationTimeout>
                                            </was.SessionManagerSpec>
                                        </sessionManagers>
                                    </was.EmbeddedWebModuleSpec>
                                </webModules>
                            </was.Ear>
                        </deployables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
    
        <dependencies>
            <dependency>
                <groupId>org.sonatype.mavenbook.multi</groupId>
                <artifactId>simple-ear</artifactId>
                <version>0.8-SNAPSHOT</version>
                <type>ear</type>
            </dependency>
        </dependencies>
    
    ...