<p>I'm trying to convince my providers to use ANT instead of Rational Application Development so anyone can recompile, recheck, redeploy the solution anyplace, anytime, anyhow. :P</p>

<p>I started a build.xml for a project that generates a JAR file but stopped there and I need real examples to compare notes. My good friends! I don't have anyone close to chat about this! </p>

<p>This is my <a href="http://pastebin.ca/1094382" rel="noreferrer">build.xml</a> so far. </p>

<p><i>(*) I edited my question based in the <a href="https://stackoverflow.com/questions/4046/can-someone-give-me-a-working-example-of-a-buildxml-for-an-ear-that-deploys-in-#4298">suggestion</a> of to use pastebin.ca</i></p>

[{'answer_id': 4902, 'author': 'McDowell', 'author_id': 304, 'author_profile': 'https://Stackoverflow.com/users/304', 'pm_score': 5, 'selected': True, 'text': '<p>My Environment: Fedora 8; WAS 6.1 (as installed with Rational Application Developer 7)</p>\n\n<p>The documentation is very poor in this area and there is a dearth of practical examples.</p>\n\n<p><strong>Using the WebSphere Application Server (WAS) Ant tasks</strong></p>\n\n<p>To run as described here, you need to run them from your server <strong>profile</strong> bin directory using the <strong>ws_ant.sh</strong> or <strong>ws_ant.bat</strong> commands.</p>\n\n<pre><code>&lt;?xml version="1.0"?&gt;\n&lt;project name="project" default="wasListApps" basedir="."&gt;\n    &lt;description&gt;\n        Script for listing installed apps.\n        Example run from:\n        /opt/IBM/SDP70/runtimes/base_v61/profiles/AppSrv01/bin\n    &lt;/description&gt;\n\n    &lt;property name="was_home"\n        value="/opt/IBM/SDP70/runtimes/base_v61/"&gt;\n    &lt;/property&gt;\n    &lt;path id="was.runtime"&gt;\n        &lt;fileset dir="${was_home}/lib"&gt;\n            &lt;include name="**/*.jar" /&gt;\n        &lt;/fileset&gt;\n        &lt;fileset dir="${was_home}/plugins"&gt;\n            &lt;include name="**/*.jar" /&gt;\n        &lt;/fileset&gt;\n    &lt;/path&gt;\n    &lt;property name="was_cp" value="${toString:was.runtime}"&gt;&lt;/property&gt;\n    &lt;property environment="env"&gt;&lt;/property&gt;\n\n    &lt;target name="wasListApps"&gt;\n        &lt;taskdef name="wsListApp"\n            classname="com.ibm.websphere.ant.tasks.ListApplications"\n            classpath="${was_cp}"&gt;\n        &lt;/taskdef&gt;\n        &lt;wsListApp wasHome="${was_home}" /&gt;\n    &lt;/target&gt;\n\n&lt;/project&gt;\n</code></pre>\n\n<p>Command:</p>\n\n<pre><code>./ws_ant.sh -buildfile ~/IBM/rationalsdp7.0/workspace/mywebappDeploy/applist.xml\n</code></pre>\n\n<p><strong>A Deployment Script</strong></p>\n\n<pre><code>&lt;?xml version="1.0"?&gt;\n&lt;project name="project" default="default" basedir="."&gt;\n&lt;description&gt;\nBuild/Deploy an EAR to WebSphere Application Server 6.1\n&lt;/description&gt;\n\n    &lt;property name="was_home" value="/opt/IBM/SDP70/runtimes/base_v61/" /&gt;\n    &lt;path id="was.runtime"&gt;\n        &lt;fileset dir="${was_home}/lib"&gt;\n            &lt;include name="**/*.jar" /&gt;\n        &lt;/fileset&gt;\n        &lt;fileset dir="${was_home}/plugins"&gt;\n            &lt;include name="**/*.jar" /&gt;\n        &lt;/fileset&gt;\n    &lt;/path&gt;\n    &lt;property name="was_cp" value="${toString:was.runtime}" /&gt;\n    &lt;property environment="env" /&gt;\n    &lt;property name="ear" value="${env.HOME}/IBM/rationalsdp7.0/workspace/mywebappDeploy/mywebappEAR.ear" /&gt;\n\n    &lt;target name="default" depends="deployEar"&gt;\n    &lt;/target&gt;\n\n    &lt;target name="generateWar" depends="compileWarClasses"&gt;\n        &lt;jar destfile="mywebapp.war"&gt;\n            &lt;fileset dir="../mywebapp/WebContent"&gt;\n            &lt;/fileset&gt;\n        &lt;/jar&gt;\n    &lt;/target&gt;\n\n    &lt;target name="compileWarClasses"&gt;\n        &lt;echo message="was_cp=${was_cp}" /&gt;\n        &lt;javac srcdir="../mywebapp/src" destdir="../mywebapp/WebContent/WEB-INF/classes" classpath="${was_cp}"&gt;\n        &lt;/javac&gt;\n    &lt;/target&gt;\n\n    &lt;target name="generateEar" depends="generateWar"&gt;\n        &lt;mkdir dir="./earbin/META-INF"/&gt;\n        &lt;move file="mywebapp.war" todir="./earbin" /&gt;\n        &lt;copy file="../mywebappEAR/META-INF/application.xml" todir="./earbin/META-INF" /&gt;\n        &lt;jar destfile="${ear}"&gt;\n            &lt;fileset dir="./earbin" /&gt;\n        &lt;/jar&gt;\n    &lt;/target&gt;\n\n    &lt;!-- http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.javadoc.doc/public_html/api/com/ibm/websphere/ant/tasks/package-summary.html --&gt;\n    &lt;target name="deployEar" depends="generateEar"&gt;\n        &lt;taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication" classpath="${was_cp}"/&gt;\n        &lt;wsInstallApp ear="${ear}" \n            failonerror="true" \n            debug="true" \n            taskname=""\n            washome="${was_home}" /&gt;\n    &lt;/target&gt;\n\n&lt;/project&gt;\n</code></pre>\n\n<p>Notes:</p>\n\n<ul>\n<li>You can only run this once! You cannot install if the app name is in use - see other tasks like <strong>wsUninstallApp</strong></li>\n<li>It probably won\'t start the app either</li>\n<li>You need to run this on the server and the script is quite fragile</li>\n</ul>\n\n<p><strong>Alternatives</strong></p>\n\n<p>I would probably use Java Management Extensions (JMX). You could write a file-upload servlet that accepts an EAR and uses the deployment MBeans to deploy the EAR on the server. You would just POST the file over HTTP. This would avoid any WAS API dependencies on your dev/build machine and could be independent of any one project.</p>\n'}, {'answer_id': 14796, 'author': 'accreativos', 'author_id': 1713, 'author_profile': 'https://Stackoverflow.com/users/1713', 'pm_score': 3, 'selected': False, 'text': '<p>a good start point, could be this <a href="http://jira.codehaus.org/browse/MOJO-392" rel="noreferrer">maven pluggin</a>, not for use it, or maybe yes, but this maven is build over ant task. If you see WAS5+Plugin+Mojo.zip\\src\\main\\scripts\\was5.build.xml</p>\n\n<p>Or as said "McDowell", you can use "WebSphere Application Server (WAS) Ant tasks" but directly as ANT task.</p>\n\n<pre><code>&lt;path id="classpath"&gt;\n    &lt;fileset file="com.ibm.websphere.v61_6.1.100.ws_runtime.jar"/&gt;\n&lt;/path&gt;\n\n&lt;taskdef name="wsStartApp" classname="com.ibm.websphere.ant.tasks.StartApplication" classpathref="classpath" /&gt;\n&lt;taskdef name="wsStopApp" classname="com.ibm.websphere.ant.tasks.StopApplication" classpathref="classpath" /&gt;\n&lt;taskdef name="wsInstallApp" classname="com.ibm.websphere.ant.tasks.InstallApplication" classpathref="classpath" /&gt;\n&lt;taskdef name="wsUninstallApp" classname="com.ibm.websphere.ant.tasks.UninstallApplication" classpathref="classpath" /&gt;\n\n&lt;target name="startWebApp1" depends="installEar"&gt;\n    &lt;wsStartApp wasHome="${wasHome.dir}" \n                application="${remoteAppName}" \n                server="${clusterServerName}" \n                conntype="${remoteProdConnType}" \n                host="${remoteProdHostName}" \n                port="${remoteProdPort}" \n                user="${remoteProdUserId}" \n                password="${remoteProdPassword}" /&gt;\n&lt;/target&gt;\n\n&lt;target name="stopWebApp1" depends="prepare"&gt;\n    &lt;wsStopApp wasHome="${wasHome.dir}"\n                application="${remoteAppName}"\n                server="${clusterServerName}"\n                conntype="${remoteConnType}"\n                host="${remoteHostName}"\n                port="${remotePort}"\n                user="${remoteUserId}"\n                password="${remotePassword}"/&gt;\n&lt;/target&gt;\n\n&lt;target name="uninstallEar" depends="stopWebApp1"&gt;\n    &lt;wsUninstallApp wasHome="${wasHome.dir}"\n                    application="${remoteAppName}"\n                    options="-cell uatNetwork -cluster DOL"\n                    conntype="${remoteConnType}"\n                    host="${remoteHostName}"\n                    port="${remoteDmgrPort}"\n                    user="${remoteUserId}"\n                    password="${remotePassword}"/&gt;\n&lt;/target&gt;\n\n&lt;target name="installEar" depends="prepare"&gt;\n    &lt;wsInstallApp ear="${existingEar.dir}/${existingEar}" \n                  wasHome="${wasHome.dir}" \n                  options="${install_app_options}"\n                  conntype="${remoteConnType}" \n                  host="${remoteHostName}" \n                  port="${remoteDmgrPort}" \n                  user="${remoteUserId}" \n                  password="${remotePassword}" /&gt;\n&lt;/target&gt;\n</code></pre>\n\n<p>Another useful link could be <a href="http://www.theserverside.com/news/thread.tss?thread_id=32285" rel="noreferrer">this</a>.</p>\n'}, {'answer_id': 113687, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>If you just want to play around why not use the netbeans IDE to generate your ear files. If you create an enterprise project it will automatically generate the ant files for you. Good for prototyping and just getting started :-)</p>\n\n<p>There is even a was plugin which allows automated deployment however this seems very shakey!</p>\n'}, {'answer_id': 141442, 'author': 'fnCzar', 'author_id': 15053, 'author_profile': 'https://Stackoverflow.com/users/15053', 'pm_score': 3, 'selected': False, 'text': '<p>Here is some of the same functionality if you don\'t have the WAS ant tasks available or don\'t want to run was_ant.bat. This relies on wsadmin.bat existing in the path.</p>\n\n<p></p>\n\n<pre><code>&lt;property name="websphere.home.dir" value="${env.WS6_HOME}" /&gt;\n&lt;property name="was.server.name" value="server1" /&gt;\n&lt;property name="wsadmin.base.command" value="wsadmin.bat" /&gt;\n\n&lt;property name="ws.list.command" value="$AdminApp list" /&gt;\n&lt;property name="ws.install.command" value="$AdminApp install" /&gt;\n&lt;property name="ws.uninstall.command" value="$AdminApp uninstall" /&gt;\n&lt;property name="ws.save.command" value="$AdminConfig save" /&gt;\n&lt;property name="ws.setManager.command" value="set appManager [$AdminControl queryNames cell=${env.COMPUTERNAME}Node01Cell,node=${env.COMPUTERNAME}Node01,type=ApplicationManager,process=${was.server.name},*]" /&gt;\n&lt;property name="ws.startapp.command" value="$AdminControl invoke $appManager startApplication" /&gt;\n&lt;property name="ws.stopapp.command" value="$AdminControl invoke $appManager stopApplication" /&gt;\n\n&lt;property name="ws.conn.type" value="SOAP" /&gt;\n&lt;property name="ws.host.name" value="localhost" /&gt;\n&lt;property name="ws.port.name" value="8880" /&gt;\n&lt;property name="ws.user.name" value="username" /&gt;\n&lt;property name="ws.password.name" value="password" /&gt;\n\n&lt;property name="app.deployed.name" value="${artifact.filename}" /&gt;\n&lt;property name="app.contextroot.name" value="/${artifact.filename}" /&gt;\n\n&lt;target name="websphere-list-applications"&gt;\n    &lt;exec dir="${websphere.home.dir}/bin" executable="${wsadmin.base.command}" output="waslist.txt" logError="true"&gt;\n        &lt;arg line="-conntype ${ws.conn.type}" /&gt;\n        &lt;arg line="-host ${ws.host.name}" /&gt;\n        &lt;arg line="-port ${ws.port.name}" /&gt;\n        &lt;arg line="-username ${ws.user.name}" /&gt;\n        &lt;arg line="-password ${ws.password.name}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.list.command}" /&gt;\n    &lt;/exec&gt;\n&lt;/target&gt;\n\n&lt;target name="websphere-install-application" depends="websphere-uninstall-application"&gt;\n    &lt;exec executable="${websphere.home.dir}/bin/${wsadmin.base.command}" logError="true" outputproperty="websphere.install.output" failonerror="true"&gt;\n        &lt;arg line="-conntype ${ws.conn.type}" /&gt;\n        &lt;arg line="-host ${ws.host.name}" /&gt;\n        &lt;arg line="-port ${ws.port.name}" /&gt;\n        &lt;arg line="-username ${ws.user.name}" /&gt;\n        &lt;arg line="-password ${ws.password.name}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.install.command} ${dist.dir}/${artifact.filename}.war {-appname ${app.deployed.name} -server ${was.server.name} -contextroot ${app.contextroot.name}}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.save.command}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.setManager.command}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.startapp.command} ${app.deployed.name}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.save.command}" /&gt;\n    &lt;/exec&gt;\n    &lt;echo message="${websphere.install.output}" /&gt;\n&lt;/target&gt;\n\n&lt;target name="websphere-uninstall-application"&gt;\n    &lt;exec executable="${websphere.home.dir}/bin/${wsadmin.base.command}" logError="true" outputproperty="websphere.uninstall.output" failonerror="false"&gt;\n        &lt;arg line="-conntype ${ws.conn.type}" /&gt;\n        &lt;arg line="-host ${ws.host.name}" /&gt;\n        &lt;arg line="-port ${ws.port.name}" /&gt;\n        &lt;arg line="-username ${ws.user.name}" /&gt;\n        &lt;arg line="-password ${ws.password.name}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.setManager.command}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.stopapp.command} ${app.deployed.name}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.save.command}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.uninstall.command} ${app.deployed.name}" /&gt;\n        &lt;arg line="-c" /&gt;\n        &lt;arg value="${ws.save.command}" /&gt;\n    &lt;/exec&gt;\n    &lt;echo message="${websphere.uninstall.output}" /&gt;\n&lt;/target&gt;\n</code></pre>\n\n<p></p>\n'}]
['https://Stackoverflow.com/questions/4046', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/527/']