| Target | Description |
|---|
| war.verify | verify distribution |
| jspc | verify distribution |
| verify | validate deployment descriptor, extensions, and bindings of jar/ear/war |
| deploy | deploys archive to was |
| undeploy | removes archive from was deploy folder |
| fdeploy | copy deployment folder to was |
| fundeploy | removes deployment folder from was |
| start | start WebSphere |
| stop | stop WebSphere |
| bind | bind EAR to WebSphere |
| list | list applications installed on a WebSphere Server |
| status | status of WebSphere server |
<?xml version="1.0" encoding="UTF-8"?>
<project name="appserver">
<description>
+ ==\_/============J=A=V=A=G=E=N===A=N=T===M=O=D=U=L=E=S================= +
+ \(_)/ +
+ -(_)- IBM WebSphere 5 Application Server Module +
+ /(_)\ +
+ ======================================================================= +
+ Copyright (c) 2002-2005 Outsource Cafe, Inc. All rights reserved. +
+ ======================================================================= +
+
+ NEEDS WORK!! - not finished
+
+ see: http://publib.boulder.ibm.com/infocenter/ws51help/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/javadoc/ae/com/ibm/websphere/ant/tasks/package-summary.html
+
+ Public targets:
+ deploy - deploys distribution file to application server
+ undeploy - removes distribution file from application server
+ fdeploy - folder deploy expands distribution files on server
+ fundeploy - folder undeploy removes expaned directory from server
+ start - starts application server
+ stop - stops application server
+ jspc - server-specific JSP compiler
+
+ Properties:
+ ${dist.name} - the distribution file name, should be predefined.
+ ${dist.dir} - the loaction of jar/war files, should be predefined.
+
+ developer: RichardEasterling@OutsourceCafe.com
+ ======================================================================= +
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ =J=A=M===========================================J=A=V=A=G=E=N=.=C=O=M= +
</description>
<property name="APPSERVER.PRESENT" value="true"></property>
<property name="WEBSPHERE5.PRESENT" value="true"></property>
<!-- ==================================================================== -->
<!-- was properties: -->
<!-- ==================================================================== -->
<!-- db settings -->
<property environment="env"></property>
<property name="was.datasource.name" value="java:/DefaultDS"></property>
<property name="was.type.mapping" value="Hypersonic SQL"></property>
<!-- was properties -->
<property name="was.home" location="${env.WAS_HOME}"></property>
<property name="was.version" value="5.0"></property>
<property name="was.lib" location="${was.home}/lib"></property>
<property name="was.client" location="${was.home}/client"></property>
<!-- Configuration used on was 3 to run your server. There must be a directory with the same name under "${was.home}/server" -->
<property name="was.configuration" value="default"></property>
<!--property name="was.configuration.lib" value="${was.home}/lib"/-->
<property name="was.configuration.lib" value="server/${was.configuration}/lib"></property>
<property name="was.server.home" location="${was.home}/server/${was.configuration}"></property>
<property name="was.table.create" value="true"></property>
<property name="was.table.remove" value="true"></property>
<property name="was.tuned.updates" value="false"></property>
<property name="was.server.name" value="server1"></property>
<property name="was.status.port" value="5559"></property>
<property name="was.username" value="reaster"></property>
<!-- global app server settings -->
<property name="appserver.name" value="WebSphere"></property>
<property name="appserver.version" value="5.x"></property>
<property name="appserver.deploy.dir" location="${was.home}/server/${was.configuration}/deploy"></property>
<property name="appserver.http.port" value="9080"></property>
<property name="appserver.host" value="localhost"></property>
<property name="appserver.start.delay" value="120"></property>
<property name="appserver.deploy.delay" value="15"></property>
<!-- log.folder is relative to was_DIST/bin folder -->
<property name="appserver.log.folder" location="${basedir}"></property>
<property name="appserver.log.file" location="${appserver.log.folder}/websphere5.log"></property>
<sequential>
<available classname="com.ibm.jsse.IBMJSSEProvider" property="JAVA_HOME.not.set.to.ibm.vm.error"></available>
<echo>JAVA_HOME = ${java.home}</echo>
<fail unless="JAVA_HOME.not.set.to.ibm.vm.error" message="MUST USE IBM JAVA, set JAVA_HOME=${was.home}/java"></fail>
</sequential>
<!-- ==================================================================== -->
<!-- was taskdef: -->
<!-- ==================================================================== -->
<path id="appserver.build.classpath">
<path refid="build.classpath"></path>
<fileset dir="${was.lib}">
<include name="wsanttasks.jar"></include>
<include name="j2ee.jar"></include>
<include name="pagelist.jar"></include>
<include name="j2ee.jar"></include>
<include name="distexcep.jar"></include>
<include name="activitySession.jar"></include>
<include name="ras.jar"></include>
<include name="wsexception.jar"></include>
<include name="jmxc.jar"></include>
<include name="webcontainer.jar"></include>
<include name="ecutils.jar"></include>
<include name="runtimefw.jar"></include>
<include name="naming.jar"></include>
</fileset>
<pathelement location="${was.home}/java/jre/lib/server.jar"></pathelement>
</path>
<taskdef name="wsStartServer" classname="com.ibm.websphere.ant.tasks.StartServer" classpathref="appserver.build.classpath"></taskdef>
<taskdef name="wsStopServer" classname="com.ibm.websphere.ant.tasks.StopServer" classpathref="appserver.build.classpath"></taskdef>
<taskdef name="wsejbdeploy" classname="com.ibm.websphere.ant.tasks.WsEjbDeploy" classpathref="appserver.build.classpath"></taskdef>
<taskdef name="wsListApps" classname="com.ibm.websphere.ant.tasks.ListApplications" classpathref="appserver.build.classpath"></taskdef>
<taskdef name="wsValidateModule" classname="com.ibm.websphere.ant.tasks.ModuleValidator" classpathref="appserver.build.classpath"></taskdef>
<taskdef name="wsjspc" classname="com.ibm.websphere.ant.tasks.JspC" classpathref="appserver.build.classpath"></taskdef>
<taskdef name="wsServerStatus" classname="com.ibm.websphere.ant.tasks.ServerStatus" classpathref="appserver.build.classpath"></taskdef>
<taskdef name="wsDefaultBindings" classname="com.ibm.websphere.ant.tasks.DefaultBindings" classpathref="appserver.build.classpath"></taskdef>
<!-- ===================================================================== -->
<!-- list build classpath -->
<!-- ===================================================================== -->
<target name="appserver.cp" depends="">
<pathconvert refid="appserver.build.classpath" property="appserver.build.list" pathsep="
"></pathconvert>
<echo message="+ appserver.build.classpath================================= +"></echo>
<echo>was.lib = ${was.lib}</echo>
<echo message="${appserver.build.list}"></echo>
</target>
<!-- ==================================================================== -->
<!-- was client properties: -->
<!-- ====================================================================
#user.services.ejb.1.contextfactory=
#user.services.ejb.1.providerurl=iiop://gungho.rchland.ibm.com
#user.services.ejb.1.cache=false
#user.services.ejb.2.name=myPrimitiveBean
#user.services.ejb.2.jndiname=PrimitiveEJB
#user.services.ejb.2.contextfactory=com.ibm.ejb.cb.runtime.CBCtxFactory
#user.services.ejb.2.providerurl=iiop://gungho.rchland.ibm.com
java.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory
java.naming.factory.url.pkgs=com.ibm.ws.naming
com.ibm.websphere.naming.namespaceroot=defaultroot
com.ibm.websphere.naming.jndicache.cacheobject=populated
com.ibm.websphere.naming.jndicache.cachename=providerURL
com.ibm.websphere.naming.jndicache.maxcachelife=0
com.ibm.websphere.naming.jndicache.maxentrylife=0
com.ibm.websphere.naming.name.syntax=jndi
com.ibm.websphere.naming.hostname.normalizer=com.ibm.ws.naming.util.DefaultHostnameNormalizer
com.ibm.websphere.naming.namespace.connection=lazy
com.ibm.ws.naming.wsn.factory.initial=com.ibm.ws.naming.util.WsnInitCtxFactory
com.ibm.ws.naming.ldap.ldapinitctxfactory=com.sun.jndi.ldap.LdapCtxFactory
-->
<property name="appserver.java.naming.factory.initial" value="com.ibm.ejb.cb.runtime.CBCtxFactory"></property>
<property name="appserver.java.naming.provider.url" value="iiop://gungho.rchland.ibm.com"></property>
<property name="appserver.java.naming.factory.url.pkgs" value="org.was.naming:org.jnp.interfaces"></property>
<path id="appserver.client.classpath">
<fileset dir="${was.client}">
<include name="*.jar"></include>
</fileset>
</path>
<!-- ==================================================================== -->
<!-- jspc properties: -->
<!-- ==================================================================== -->
<property name="appserver.jspc.java.dir" location="${build.web.jspc.dir}"></property>
<property name="appserver.jspc.classes.dir" location="${build.web.jspc.dir}"></property>
<property name="jspc.package" value="."></property>
<property name="jspc.uriroot" location="${build.web.dir}"></property>
<path id="jspc.classpath">
<path refid="appserver.build.classpath"></path>
<!--
<path refid="build.web.classpath"/>
<pathelement location="${jasper.compiler.jar}"/>
<pathelement location="${jasper.runtime.jar}"/>
-->
</path>
<!-- ==================================================================== -->
<!-- was setup checks: -->
<!-- ==================================================================== -->
<target name="check.appserver">
<antcall target="check-was"></antcall>
<available property="was.present" file="${was.home}/bin/wsadmin.bat"></available>
<antcall target="wrong-was"></antcall>
<!--
<available property="junit.present" file="${was.home}/${was.configuration.lib}/${junit.jar.name}"/>
<antcall target="check-junit"/>
-->
</target>
<target name="check-was" unless="was.home">
<fail>Property "was.home" is not set. Please use the file "ant.properties" in the ${basedir} directory to set this property. It must point to the directory which contains the following directory: "bin", "client", "server" etc.</fail>
</target>
<target name="wrong-was" unless="was.present">
<fail>Property "was.home" is set but it does not seem to point to the right directory. The file "run.jar" must be available at ${was.home}/bin. </fail>
</target>
<!--
<target name="check-junit" unless="junit.present">
<fail>Jar file "${junit.jar.name}" NOT found in was directory: ${was.home}/${was.configuration.lib}. This will cause unit test problems using "junitejb". </fail>
</target>
-->
<!-- =================================================================== -->
<!-- compiles JSPs to java, then to classes -->
<!-- =================================================================== -->
<target name="war.verify" depends="jspc" description="verify distribution"></target>
<!-- =================================================================== -->
<!-- compiles JSPs to java, then to classes -->
<!-- =================================================================== -->
<target name="jspc" depends="" description="verify distribution">
<mkdir dir="${appserver.jspc.classes.dir}"></mkdir>
<mkdir dir="${appserver.jspc.java.dir}"></mkdir>
<echo>appserver.jspc.classes.dir = ${appserver.jspc.classes.dir}</echo>
<echo>appserver.jspc.java.dir = ${appserver.jspc.java.dir}</echo>
<echo>build.web.dir = ${build.web.dir}</echo>
<wsjspc wasHome="${was.home}" src="${build.web.dir}" toDir="${appserver.jspc.java.dir}" classpathref="jspc.classpath"></wsjspc>
<!-- classpath="ear classes" -->
<javac srcdir="${appserver.jspc.java.dir}" destdir="${appserver.jspc.classes.dir}" classpathref="jspc.classpath" debug="${compiler.debug}" deprecation="${compiler.deprecation}" optimize="${compiler.optimize}" compiler="${compiler.type}"></javac>
</target>
<!-- =================================================================== -->
<!-- validation of the deployment descriptor, extensions, and bindings -->
<!-- =================================================================== -->
<target name="verify" depends="" description="validate deployment descriptor, extensions, and bindings of jar/ear/war">
<wsValidateModule src="${dist.file}"></wsValidateModule>
</target>
<!-- =================================================================== -->
<!-- deploy archive (jar/war/ear) to server -->
<!-- =================================================================== -->
<!--
<wsejbdeploy inputJar="jarfile"
workingDirectory="temp directory" wasHome="WebSphere Installation Directory"
outputJar="out jarfile" classpathref="ear classes element reference"
codegen="true | false" dbname="Database name"
dbschema="Database Schema Name" dbvendor="Database Vendor"
dynamic="Enable Dynamic Query Support" classpath="ear classes"
keepGenerated="true | false" trace="true | false"
quiet="true | false" noValidate="true | false"
noWarnings="true | false" noInform="true | false"
rmicOptions="rmic options" compatible35="true | false"
sqlj="true | false" failonerror="true | false"
/>
Database Vendors:
DB2UDB_V72 DB2UDB_V81 CLOUDSCAPE_V5
DB2UDBOS390_V6 DB2UDBOS390_V7 DB2UDBISERIES
INFORMIX_V73 INFORMIX_V93
MSSQLSERVER_V7 MSSQLSERVER_2000
ORACLE_V8 ORACLE_V9I
SYBASE_V1200 SYBASE_V1250
-->
<target name="deploy" depends="" description="deploys archive to was">
<copy todir="${appserver.deploy.dir}">
<fileset dir="${dist.dir}" includes="${dist.name}"></fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- remove archive (jar/war/ear) from server -->
<!-- =================================================================== -->
<target name="undeploy" description="removes archive from was deploy folder">
<delete file="${appserver.deploy.dir}/${dist.name}"></delete>
</target>
<!-- =================================================================== -->
<!-- deploy unpacked files to server -->
<!-- =================================================================== -->
<target name="fdeploy" depends="" description="copy deployment folder to was">
<mkdir dir="${appserver.deploy.dir}/${dist.name}"></mkdir>
<unzip src="${dist.dir}/${dist.name}" dest="${appserver.deploy.dir}/${dist.name}"></unzip>
</target>
<!-- =================================================================== -->
<!-- remove unpacked deployment from server - server must be stopped -->
<!-- =================================================================== -->
<target name="fundeploy" description="removes deployment folder from was">
<delete dir="${appserver.deploy.dir}/${dist.name}"></delete>
</target>
<!-- =================================================================== -->
<!-- deploydelay -->
<!-- =================================================================== -->
<target name="deploydelay">
<echo>sleeping ${appserver.deploy.delay}s...</echo>
<sleep seconds="${appserver.deploy.delay}"></sleep>
</target>
<!-- =================================================================== -->
<!-- start was -->
<!-- =================================================================== -->
<!--
<wsStartServer
server="name of the server to start"
noWait="true | <b>false</b>"
quiet="true | <b>false</b>"
logFile="name of the file to log to"
replaceLog="true | <b>false</b>"
trace="true | <b>false</b>"
script="the name of a script file to execute during server startup"
timeout="amount of time to wait for the server to start"
statusPort="port for the server to send status messages to"
username="name of the admin userid id to authenticate with"
password="password of the admin user to authenticate with"
wasHome="WebSphere Installation directory"
failonerror="true | <b>false</b>"/>
-->
<target name="start" depends="started" unless="server.started" description="start WebSphere">
<wsStartServer server="${was.server.name}" noWait="false" quiet="false" logFile="${appserver.log.file}" replaceLog="false" trace="false" timeout="${appserver.start.delay}" wasHome="${was.home}" statusPort="${was.status.port}" username="${was.username}" failonerror="true"></wsStartServer>
<!-- password="" script=""
-->
</target>
<target name="started">
<condition property="server.started">
<and>
<socket port="${appserver.http.port}" server="${appserver.host}"></socket>
</and>
</condition>
<echo>server.started = ${server.started}</echo>
</target>
<!-- =================================================================== -->
<!-- stop was -->
<!-- =================================================================== -->
<!--
<wsStopServer
server="name of the server to stop"
noWait="true | <b>false</b>"
quiet="true | <b>false</b>"
logFile="name of the file to log to"
replaceLog="true | <b>false</b>"
trace="true | <b>false</b>"
timeout="amount of time to wait for the server to stop"
statusPort="port for the server to send status messages to"
conntype="SOAP | RMI"
host="hostname of the machine running the server you wish to stop"
port="admin port of the server you wish to stop"
username="name of the admin userid id to authenticate with"
password="password of the admin user to authenticate with"
wasHome="WebSphere Installation directory"
failonerror="true | <b>false</b>"/>
-->
<target name="stop" depends="stopped" if="can.end" description="stop WebSphere">
<wsStopServer server="${was.server.name}" noWait="false" quiet="false" logFile="${appserver.log.file}" replaceLog="false" trace="false" timeout="${appserver.start.delay}" wasHome="${was.home}" statusPort="${was.status.port}" username="${was.username}" failonerror="true"></wsStopServer>
<!-- password="" conntype="" host="${appserver.host}" port="${appserver.http.port}"
-->
<echo>sleeping 4s...</echo>
<sleep seconds="4"></sleep>
</target>
<target name="stopped">
<condition property="can.end">
<and>
<socket port="${appserver.http.port}" server="${appserver.host}"></socket>
<not>
<isset property="server.started"></isset>
</not>
</and>
</condition>
<echo>can.end = ${can.end}</echo>
</target>
<!-- =================================================================== -->
<!-- stop was -->
<!-- =================================================================== -->
<!--
<wsDefaultBindings
ear="the ear file you wish to install"
outputFile="output ear to generate"
defaultDataSource="JNDI Name of the default datasource to use for the application"
dbUser="Database user id"
dbPassword="Datebase password"
defaultConnectionFactory="JNDI name of the default connection factory to be used by the application"
resAuth="PerConnFact | Container"
ejbJndiPrefix="String to prefix to the front of all generated EJB JNDI Names"
virtualHost="Virtual Host name for the application to execute on"
forceBindings="true | false"
strategy="Generation Strategy"
exportFile="exported strategy file"/>
-->
<target name="bind" depends="" description="bind EAR to WebSphere">
<echo>BROKEN...</echo>
<wsDefaultBindings ear="${test.dist.file}" outputFile="${test.dist.file}2" forceBindings="false"></wsDefaultBindings>
<!-- defaultDataSource="" dbUser="" dbPassword=""
-->
</target>
<!-- =================================================================== -->
<!-- list applications installed on a WebSphere Server -->
<!-- =================================================================== -->
<target name="list" depends="" description="list applications installed on a WebSphere Server">
<wsListApps wasHome="${was.home}" user="${was.username}" password=""></wsListApps>
<!-- properties="" host="localhost" conntype="" port="${appserver.http.port}" profile=""
-->
</target>
<!-- =================================================================== -->
<!-- get server status -->
<!-- =================================================================== -->
<target name="status" depends="" description="status of WebSphere server">
<wsServerStatus server="${was.server.name}" quiet="false" trace="false" all="false" wasHome="${was.home}" failonerror="true"></wsServerStatus>
<!-- cell="" node="" timeout="20" statusPort="${was.status.port}" -->
</target>
</project>