- Introduction
- Goal-
deploy
- Single Target Server
- Multi Target Servers
- Pre-Steps and Post-Steps
- Customized Jython Script File
- Continues Deployment with Jenkins
- With Global Security Turned on
- Change List
Maven plugin to deploy a single war or ear to one or multi local or remote WebSphere Application Server (WAS) at a single build.
Tested on WAS 8.5
NOTE: WebSphere Application Server installation required on host box!
The only goal of this plugin, it will:
- Check if an application with the same name already installed on target server(s)/cluster(s)
- Uninstall it if yes
- Install the package to target server(s)/cluster(s)
- Restart target server(s)/cluster(s)
Name | Type | Description |
---|---|---|
wasHome | String | WebSphere Application Server home. Default: ${env.WAS_HOME} , required |
applicationName | String | Application name displayed in admin console. Default: ${project.build.finalName} |
applicationNameSuffix | String | Suffix will be appended to applicationName, as applicationName_applicationNameSuffix |
host | String | Local/Remote WAS IP/domain URL. e.g. 10.95.0.100 , devtrunk01.company.com , default: localhost |
port | String | Default: 8879 (when cluster not empty); 8880 (when cluster empty) |
connectorType | String | Default: SOAP |
cluster | String | Target cluster name, required if target WAS is a cluster |
cell | String | Target cell name |
node | String | Target node name, required if target WAS is NOT a cluster |
server | String | Target server name, required |
virtualHost | String | Target virtual host name |
user | String | Account username for target WAS admin console, if global security is turned on |
password | String | Account password for target WAS admin console, if global security is turned on |
contextRoot | String | required for war deployment |
sharedLibs | String | Bind the exist shared libs to ear/war, comma-separated (,) |
parentLast | Boolean | true to set classloader mode of application to PARENT_LAST , default false |
webModuleParentLast | Boolean | true to set classloader mode of web module to PARENT_LAST , default false |
packageFile | String | The EAR/WAR package that will be deployed to remote RAS, Default: ${project.artifact.file} |
failOnError | Boolean | Default: false Whether failed the build when failed to deploy. |
verbose | Boolean | Whether show more detailed info in log |
script | String | Your own jython script for deployment. Double braces for variables, such as: {{cluster}} |
scriptArgs | String | Args that will be passed to the script |
preSteps | Ant tasks | Ant tasks that can be executed before the deployments |
postSteps | Ant tasks | Ant tasks that can be executed after the deployments |
deploymentsPropertyFile | File | For multi target, hold above parameters, except those in bold. Default: was-maven-plugin.properties |
Generally, you need to specify at least
claster
andserver
for a clusterserver
andnode
for a non-cluster
<plugin>
<groupId>com.orctom.mojo</groupId>
<artifactId>was-maven-plugin</artifactId>
<version>1.0.7</version>
<executions>
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<wasHome>${env.WAS_HOME}</wasHome>
<applicationName>${project.build.finalName}</applicationName>
<host>localhost</host>
<server>server01</server>
<node>node01</node>
<virtualHost>default_host</virtualHost>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
This property file contains the meta config for target WAS.
The section name will be used to identify each target WAS.
Please put was-maven-plugin.properties
to the same folder as pom.xml
, to make it available as ${project.basedir}/was-maven-plugin.properties
[DEFAULT]
virtualHost=default_host
[dev-trunk1]
host=devtrunk1.company.com
applicationNameSuffix=trunk1
cluster=cluster01
server=server01
[dev-trunk2]
host=devtrunk2.company.com
applicationNameSuffix=trunk2
cluster=cluster02
server=server02
[dev-trunk3]
host=devtrunk3.company.com
applicationNameSuffix=trunk3
cluster=cluster03
server=server03
virtualHost=devtrunk3_host
<plugin>
<groupId>com.orctom.mojo</groupId>
<artifactId>was-maven-plugin</artifactId>
<version>1.0.7</version>
<executions>
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<wasHome>${env.WAS_HOME}</wasHome>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
Deploy to dev-trunk1 and dev-trunk2
mvn clean install -Ddeploy_targets=dev-trunk1,dev-trunk2
Deploy to dev-trunk2 and dev-trunk3
mvn clean install -Ddeploy_targets=dev-trunk2,dev-trunk3
<plugin>
<groupId>com.orctom.mojo</groupId>
<artifactId>was-maven-plugin</artifactId>
<version>1.0.7</version>
<executions>
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<wasHome>${env.WAS_HOME}</wasHome>
<verbose>true</verbose>
<preSteps>
<target name="pre 1">
<echo message="====== pre 1 ===== ${applicationName}" />
</target>
<target name="pre 2">
<echo message="====== pre 2 =====" />
</target>
</preSteps>
<postSteps>
<target name="post 1">
<echo message="====== post 1 =====" />
</target>
<target name="post 2">
<echo message="====== post 2 =====" />
<sleep seconds="10"/>
</target>
</postSteps>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>20020829</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.49</version>
</dependency>
</dependencies>
</plugin>
- pre-steps/post-steps can be used with both single target server and multi target servers
- All properties defined in properties section of pom or in was-maven-plugin.properties are available in pre-steps/post-steps ant tasks
If you'd like to go with a customized jython script file for deployment.
Double braces for variables, such as: {{cluster}}
, properties in was-maven-plugin.properties are all available as variables.
<plugin>
<groupId>com.orctom.mojo</groupId>
<artifactId>was-maven-plugin</artifactId>
<version>1.0.7</version>
<executions>
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<wasHome>${env.WAS_HOME}</wasHome>
<script>your-jython-script.py</script><!-- "/xxx" for absolute path; "xxx" for ${basedir}/xxx -->
<scriptArgs>optional-args</scriptArgs>
<verbose>true</verbose>
</configuration>
</execution>
</executions>
</plugin>
We could move this plugin to a profile, and utilize Extended Choice Parameter plugin to make this parameterized.
<profiles>
<profile>
<id>deploy</id>
<activation>
<property>
<name>deploy</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.orctom.mojo</groupId>
<artifactId>was-maven-plugin</artifactId>
<version>1.0.7</version>
<executions>
<execution>
<id>deploy</id>
<phase>install</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<wasHome>${env.WAS_HOME}</wasHome>
<verbose>true</verbose>
<preSteps>
<target name="unzip-Config-zip">
<echo message="Unzipping ${project.build.directory}/Config.zip --> WAS shared libs folder" />
<unzip dest="${WAS shared libs folder}/conf">
<fileset dir="${project.build.directory}/">
<include name="Config.zip" />
</fileset>
</unzip>
</target>
<target name="unzip-static-zip">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<if>
<available file="${project.build.directory}/static.zip" />
<then>
<echo message="Unzipping ${project.build.directory}/static.zip --> apache sratic path" />
<unzip dest="${apache sratic path}" src="${project.build.directory}/static.zip" />
</then>
</if>
</target>
<target name="copy-config-to-remote">
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<if>
<isset property="some property name in pom or was-maven-plugin/properties" />
<then>
<echo message="Coping ${WAS shared libs folder}/conf to ${remote ip}:${WAS shared libs folder}/conf ..." />
<scp todir="wsadmin@${remote ip}:${WAS shared libs folder}/conf" keyfile="${user.home}/.ssh/id_rsa" trust="true" failonerror="false">
<fileset dir="${WAS shared libs folder}/conf" />
</scp>
<echo message="Copied ${meta.config.path}/conf" />
</then>
<else>
<echo message="Skipped, not needed." />
</else>
</if>
</target>
</preSteps>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>20020829</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.8.4</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.49</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Configure
Trigger
When Global Security is enabled on remote WAS (not under a same deployment manager), certificates of remote WAS need to be added to local trust store. We could configure WAS to prompt to add them to local trust store.
- Open ${WAS_HOME}/properties/ssl.client.props
- Change the value of
com.ibm.ssl.enableSignerExchangePrompt
togui
orstdin
gui
: will prompt a Java based window, this requires a X window installed.stdin
: when using ssh, or on client linux without X window installed.
- Not to check whether parent folder of deployment script been created or not.
- removed
preCompileJSPs
options for deployment.
- Fixed multi-server deployment issue.
- Downgraded to use 1.5 build level, so that it can be used for older version of websphere.
- Fixed property resolving issue, properties in was-maven-plugin.properties are all available in custome scripts and pre/post steps.
- Added
PARENT_LAST
for application and web module andsahred libs
bindings. - Added
failonerror
- Removed private project specific logic. (it's the 1st working version for general projects for websphere deployment).