Remote deploy to Websphere - Take 3
First post is Here
Second post is Here
This is still work in progress and needs refinement (a How-I-Did-It not a How-To).
Running with Rational Application Developer 6.0.0.1 w/Interim Fix 003.
Although I've tested the concepts, yet, I haven't yet managed to execute
a compete cycle of Checkout (from CVS), Build App, Generate EAR, Deploy
EAR to server. I still have issues to deal with regarding the migration
from WS5.x to WS6.0.0.1 (It might not be solved before WS 6.0.1).
Some of the targets below are used to invoke Headless ANT targets instead of using a batch file as per IBM examples (regular ANT targets
invoking Headless ANT targets).
Also, the ear.deploy target need to be reworked following the other targets (though it works in its current state).
Again this is still work in progress which I currently have to leave for a while.
For all the desperate Websphere ANT tasks googlers - here it is - deploy.xml
<?xml version="1.0"?>
<project name="Build" default="default" basedir=".">
<property file="build.properties"></property>
<property name="ear.file.name" value="${workspace}/${project.name}.ear"/>
<property name="path.on.server" value="Temp"/>
<property name="runtime.file" value="C:\Program Files\IBM\Rational\SDP\6.0\runtimes\base_v6\lib\wsanttasks.jar"/>
<property name="runtime.path" value="C:\Program Files\IBM\Rational\SDP\6.0\rwd\eclipse\plugins\com.ibm.etools.j2ee.ant_6.0.0.1\runtime"/>
<property name="core.runtime.path" value="C:\Program Files\IBM\Rational\SDP\6.0\eclipse\plugins\org.eclipse.core.runtime_3.0.2"/>
<property name="resources.path" value="C:\Program Files\IBM\Rational\SDP\6.0\eclipse\plugins\org.eclipse.core.resources_3.0.1"/>
<property name="osgi.path" value="C:\Program Files\IBM\Rational\SDP\6.0\eclipse\plugins\org.eclipse.osgi_3.0.1"/>
<property name="startup.file" value="C:\Program Files\IBM\Rational\SDP\6.0\eclipse\startup.jar"/>
<property name="rational.home" value="C:/Progra~1/IBM/Rational/SDP/6.0/nuntimes/base_v6/bin"/>
<path id="rational.classpath">
<fileset file="${runtime.file}"></fileset>
<fileset dir="${runtime.path}">
<include name="**/antextras.jar"/>
<include name="**/antj2ee.jar"/>
<include name="**/antrunner.jar"/>
</fileset>
<fileset dir="${core.runtime.path}">
<include name="**/nuntime.jar"/>
</fileset>
<fileset dir="${resources.path}">
<include name="**/nesources.jar"/>
<include name="**/nesources-ant.jar"/>
</fileset>
<fileset dir="${osgi.path}">
<include name="**/osgi.jar"/>
</fileset>
</path>
<path id="eclipse.classpath">
<fileset file="${startup.file}"></fileset>
</path>
<!-- ===============================================
target: default
==================================================== -->
<target name="default">
<echoproperties srcfile="build.properties"></echoproperties>
<echo> ----------------------------------------- </echo>
<echo message="Please Select A Target To Run"></echo>
</target>
<!-- ===============================================
target: get.app.from.cvs
==================================================== -->
<target name="get.app.from.cvs"
description="Checks out the Project from CVS into the workspace directory">
<cvs
cvsRoot=":pserver:${cvs.username}:${cvs.password}@${cvs.host.name}:${cvs.dir}"
command="checkout"
quiet="true"
package="${project.name}"
failonerror="true"
dest="${cvs.checkout.dir}"
/>
</target>
<!-- =================================
target: project.import
================================= -->
<target name="project.import" description="Imports a project into the workspace">
<!-- Stupidly non-elegant -->
<!-- Running headless ant which in turn run this (the same) build file invoking the headless.import task -->
<!-- Project has to be imported even if it's physically under the workspace -->
<java
classpathref="eclipse.classpath"
classname="org.eclipse.core.launcher.Main"
failonerror="true"
fork="true"
resultproperty="return">
<arg line="-application com.ibm.etools.j2ee.ant.RunAnt -data ${workspace} -verbose -buildfile deploy.xml headless.import" />
</java>
</target>
<target name="headless.import">
<!-- Could not import from the file system using projectlocation="${cvs.checkout.dir}" , have to import the project when its contents are in the workspace directory -->
<!-- Importing my web project together with the enterprise one -->
<projectImport projectname="${project.name}" />
<projectImport projectname="${ear.project.name}" />
<eclipse.refreshLocal resource="${project.name}/JavaSource" depth="infinite" />
</target>
<!-- =================================
target: project.build
================================= -->
<target name="project.build" description="Build the application">
<!-- Stupidly non-elegant -->
<!-- Running headless ant which in turn run this (the same) build file invoking the headless.build task -->
<java
classpathref="eclipse.classpath"
classname="org.eclipse.core.launcher.Main"
failonerror="true"
fork="true"
>
<arg line="-application com.ibm.etools.j2ee.ant.RunAnt -data ${workspace} -verbose -buildfile deploy.xml headless.build"/>
</java>
</target>
<target name="headless.build">
<projectBuild
projectname="${project.name}"
failonerror="false"
showerrors="true"
debugcompilation="true"
quiet="true"
buildtype="${build.type}"
summary="true"/>
</target>
<!-- =================================
target: ear.generate
================================= -->
<target name="ear.generate" description="Geneartes the ear file">
<!-- Stupidly non-elegant -->
<!-- Running headless ant which in turn run this (the same) build file invoking the headless.ear.generate task -->
<java
classpathref="eclipse.classpath"
classname="org.eclipse.core.launcher.Main"
failonerror="true"
fork="true"
resultproperty="return">
<arg line="-application com.ibm.etools.j2ee.ant.RunAnt -data ${workspace} -verbose -buildfile deploy.xml headless.ear.export" />
</java>
</target>
<target name="headless.ear.export">
<earExport
overwrite="true"
exportsource="false"
includeprojectmetafiles="false"
EARProjectName="${ear.project.name}"
EARExportFile="${ear.file.name}"/>
</target>
<!-- ===============================================
target: ear.deploy
==================================================== -->
<target name="ear.deploy" depends="upload.ear.file" description="Deploys the EAR file to the server">
<exec dir="${rational.home}" executable="cmd" os="Windows XP">
<arg line="/c wsadmin.bat -conntype SOAP -host ${websphere.host.name} -port ${websphere.soap.port} -lang jython -c "AdminApp.install('${path.on.server}/${project.name}.ear}', '-nopreCompileJSPs -defaultbinding.virtual.host default_host -verbose')"" />
</exec>
</target>
</project>
End of deploy.xml
Comments(8)