Deploy ear file in to App.server using ANT

05 Mar

Hi folks,

Here is the post to generate ear file and deploy in to the application server using the ant build.xml file.

Below is the build.xml file which will create war and ear file and deploy in to application server.

<project name=”sampledemo” basedir=”.” default=”deploy”>
<property name=”build” value=”./bin” />
<property name=”src” value=”./src” />
<property name=”version” value=”0.1″ />
<property name=”deployDir” value=”${harcode path here where should it deploy}” />
<property name=”warFile” value=”${dist}/${}.war” />
<property name=”earFile” value=”${dist}/${}-${version}.ear” />

<target name=”clean”>
<echo>********* deleting directories *********</echo>
<delete dir=”${build}” />
<delete dir=”${dist}” />

<target name=”init”>
<echo>********* creating directories *********</echo>
<tstamp />
<mkdir dir=”${build}” />
<mkdir dir=”${dist}” />
<mkdir dir=”${web}” />

<target name=”compile” depends=”init”>
<echo>********* compiling the java source code *********</echo>
<javac srcdir=”${src}” destdir=”${build}” optimize=”on”>
<classpath refid=”build.classpath” />

<target name=”war” depends=”compile” >
<echo>********* generating war file ${}.war *********</echo>
<war destfile=”${dist}/${}.war” webxml=””>
<classes dir=”${build}”/>
<zipfileset dir=”${web}” />

<target name=”ear” depends=”war”>
<echo>********* generating ear file ${}-${version}.ear *********</echo>
<ear destfile=”${dist}/${}-${version}.ear” appxml=””>
<fileset dir=”${dist}” includes=”*.war” />

<target name=”deploy” depends=”ear”>
<echo>********* deploying ear file to ${deployDir} *********</echo>
<copy todir=”${deployDir}”>
<fileset dir=”${dist}” includes=”*.ear” />

Hope this will save your time for some extent.

Use below URL to get more information about build.xml file.

Sample build.xml

Happy Coding!.

Stay tuned for more updates.

Have a nice day:-)

1 Comment

Posted by on March 5, 2013 in Uncategorized


One response to “Deploy ear file in to App.server using ANT

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: