title: convert ant script into gradle script
body: <p>How do you convert ant script into gradle script?
  Hi, 
  Can you please help me to convert ant script into gradle script. I am new user of gradle. </p>
  
  <p>
      
      </p>
  
  <pre><code>&lt;property name="pm-dir"                value="${PM-DIR}/${BUILD_NUM}" /&gt;
  &lt;property name="leis-dir"              value="${LEIS_DIR}/${BUILD_NUM}" /&gt;
  
  &lt;property name="proxy-name"             value="${PROXY_JAR_NAME}"/&gt;
  &lt;property name="proxy-client-name"      value="${PROXY_CLIENT_JAR_NAME}"/&gt;
  
  &lt;property environment="env"/&gt;
  &lt;property name="java-home"              value="${env.JAVA_HOME}"/&gt;
  
    &lt;condition property="build-pm"&gt;
      &lt;equals arg1="True" arg2="${BUILD_PM}" /&gt;
  &lt;/condition&gt;
  
  &lt;condition property="build-LEIS"&gt;
      &lt;equals arg1="True" arg2="${BUILD_LEIS}" /&gt;
  &lt;/condition&gt;
  
  
  &lt;target name="build-LEIS-components" if="build-LEIS"&gt;
  
      &lt;ant antfile="build.xml"
           target="clean"
           dir="${leis-dir}/LEIS"
           inheritAll="false"/&gt;
      &lt;ant antfile="build.xml"
           target="ejbdoclet"
           dir="${leis-dir}/LEIS/BusinessServices"
           inheritAll="false"/&gt;
      &lt;ant antfile="build.xml"
           target="jar"
           dir="${leis-dir}/LEIS"
           inheritAll="false"/&gt;
  
      &lt;ant antfile="build.xml"
           target="clean"
           dir="${leis-dir}/ETS/trunk/Entitlements"
           inheritAll="false"/&gt;
      &lt;ant antfile="build.xml"
           target="build"
           dir="${leis-dir}/ETS/trunk/Entitlements"
           inheritAll="false"/&gt;
  
      &lt;mkdir dir="${leis-dir}/JARS/APP-INF/lib/"/&gt;
  
      &lt;jar jarfile="${leis-dir}/JARS/APP-INF/lib/LEISConfig.jar"&gt;
          &lt;fileset dir="LEIS/" includes="datetime.properties"/&gt;
          &lt;fileset dir="LEIS/" includes="log4j.properties"/&gt;
          &lt;manifest&gt;
              &lt;attribute name="Built-By" value="${user.name}"/&gt;
          &lt;/manifest&gt;
      &lt;/jar&gt;
  &lt;/target&gt;
  
  
  &lt;!--========================================================================
  Builds pm using the supplied RE build files, modified by us.
  ========================================================================--&gt;
  &lt;target name="build-pm" if="build-pm"&gt;
  
  
  
  
      &lt;!-- SPPResourceBundle Overrides --&gt;
      &lt;mkdir dir="${pm-dir}/pm2/deploy/propertyoverrides"/&gt;
      &lt;copy todir="${pm-dir}/pm2/deploy/propertyoverrides" overwrite="true"&gt;
          &lt;fileset dir="olwpmconfig/propertyoverrides"/&gt;
      &lt;/copy&gt;
  
      &lt;!-- copy build.properties into pm dir, complete with kodo key --&gt;
      &lt;copy file="olwpmconfig/build.properties"      todir="${pm-dir}/pm2/"            overwrite="true"&gt;
          &lt;filterchain&gt;         
                 &lt;replacetokens&gt;
                     &lt;token key="LOGGINGFLOOR" value="${PERFORMANCE_LOGGING_FLOOR}"/&gt;
                     &lt;token key="BEADIR" value="${BEA_HOME}"/&gt;
                 &lt;/replacetokens&gt;
          &lt;/filterchain&gt;
      &lt;/copy&gt;
  
      &lt;!--the actual Retail Express build scripts to create the pm-main.ear--&gt;
      &lt;echo message="Calling pm Build Script"/&gt;
      &lt;ant antfile='${pm-dir}/pm2/build/build.xml'          target='clean-build' inheritAll="false"/&gt;
  
      &lt;!--delete the extra copy of jdo.dtd--&gt;
      &lt;delete file="jdo.dtd" /&gt;
  
      &lt;fileset id="required-pm-client-libs" dir="${pm-dir}/pm2/deploy/lib"&gt;
          &lt;include name="*.jar"/&gt;
          &lt;include name="client/*.jar"/&gt;
          &lt;exclude name="*tests.jar"/&gt;
      &lt;/fileset&gt;
  
      &lt;!-- Used to populate value of MANIFEST.MF Class-path attribute. Turns our set of "required" libs
       into a nice space separated string to place in the MANIFEST.MF. Property is used in the "dist"
       task's jar command. --&gt;
      &lt;pathconvert property="client-classpath"
                   refid="required-pm-client-libs"
                   pathsep=" "
                   dirsep="/"&gt;
          &lt;map from="${pm-dir}/pm2/deploy/lib/" to=""/&gt;
      &lt;/pathconvert&gt;
  
      &lt;jar update="true" jarfile="${pm-dir}/pm2/deploy/lib/pm-core.jar"&gt;
          &lt;manifest&gt;
              &lt;attribute name="Class-Path" value="${client-classpath}"/&gt;
              &lt;attribute name="Main-Class" value="com.retailexp.pm.ui.util.SPPClientStartUp"/&gt;
          &lt;/manifest&gt;
      &lt;/jar&gt;
  
      &lt;!-- Creates a file Marimba/BigFix/WhatEver can use to track the version of pm installed on a machine --&gt;
      &lt;echo message="${pm_MAJOR_VERSION}.${BUILD_NUM}" file="${pm-dir}/pm2/deploy/lib/version.txt" append="false"/&gt;
  
      &lt;!-- Remove files we place on classpath from ears, Mantis 10624 --&gt;
      &lt;!-- pm --&gt;
      &lt;move file="${pm-dir}/pm2/deploy/dist/pm-main.ear" tofile="${pm-dir}/pm2/deploy/dist/old-pm-main.ear"/&gt;
      &lt;unzip src="${pm-dir}/pm2/deploy/dist/old-pm-main.ear" dest="${pm-dir}/pm2/deploy/dist/"&gt;
          &lt;patternset&gt;
              &lt;include name="lib/pm-server-conf.jar"/&gt;
          &lt;/patternset&gt;
      &lt;/unzip&gt;
      &lt;move file="${pm-dir}/pm2/deploy/dist/lib/pm-server-conf.jar" tofile="${pm-dir}/pm2/deploy/dist/lib/old-pm-server-conf.jar"/&gt;
      &lt;zip file="${pm-dir}/pm2/deploy/dist/lib/pm-server-conf.jar"&gt;
          &lt;zipfileset src="${pm-dir}/pm2/deploy/dist/lib/old-pm-server-conf.jar"&gt;
              &lt;exclude name="log4j.properties"/&gt;
              &lt;exclude name="ehcache-transactional.xml"/&gt;
          &lt;/zipfileset&gt;
      &lt;/zip&gt;
      &lt;zip file="${pm-dir}/pm2/deploy/dist/pm-main.ear"&gt;
          &lt;zipfileset src="${pm-dir}/pm2/deploy/dist/old-pm-main.ear"&gt;
              &lt;exclude name="lib/pm-server-conf.jar"/&gt;
          &lt;/zipfileset&gt;
          &lt;zipfileset dir="${pm-dir}/pm2/deploy/dist/lib/" includes="pm-server-conf.jar" fullpath="lib/pm-server-conf.jar"/&gt;
      &lt;/zip&gt;
      &lt;!-- EDM --&gt;
      &lt;move file="${pm-dir}/pm2/deploy/dist/pm-edm.ear" tofile="${pm-dir}/pm2/deploy/dist/old-pm-edm.ear"/&gt;
      &lt;unzip src="${pm-dir}/pm2/deploy/dist/old-pm-edm.ear" dest="${pm-dir}/pm2/deploy/dist/"&gt;
          &lt;patternset&gt;
              &lt;include name="lib/pm-server-conf.jar"/&gt;
          &lt;/patternset&gt;
      &lt;/unzip&gt;
      &lt;move file="${pm-dir}/pm2/deploy/dist/lib/pm-server-conf.jar" tofile="${pm-dir}/pm2/deploy/dist/lib/old-pm-server-conf.jar"/&gt;
      &lt;zip file="${pm-dir}/pm2/deploy/dist/lib/pm-server-conf.jar"&gt;
          &lt;zipfileset src="${pm-dir}/pm2/deploy/dist/lib/old-pm-server-conf.jar"&gt;
              &lt;exclude name="log4j.properties"/&gt;
          &lt;/zipfileset&gt;
      &lt;/zip&gt;
      &lt;zip file="${pm-dir}/pm2/deploy/dist/pm-edm.ear"&gt;
          &lt;zipfileset src="${pm-dir}/pm2/deploy/dist/old-pm-edm.ear"&gt;
              &lt;exclude name="lib/pm-server-conf.jar"/&gt;
          &lt;/zipfileset&gt;
          &lt;zipfileset dir="${pm-dir}/pm2/deploy/dist/lib/" includes="pm-server-conf.jar" fullpath="lib/pm-server-conf.jar"/&gt;
      &lt;/zip&gt;
  &lt;/target&gt;
  
  &lt;!--========================================================================
  Builds LEIS
  ========================================================================--&gt;
  &lt;target name="build-proxy" if="build-LEIS"&gt;
  
      &lt;!--copy deploy.properties with the proper jar names and locations--&gt;
      &lt;copy file="LEIS/deploy.properties"        todir="${leis-dir}/proxy/config/build/"    overwrite="true"&gt;
          &lt;filterchain&gt;
                 &lt;replacetokens&gt;
                      &lt;token key="pmCORE"            value="${pm_CORE_NAME}"/&gt;
                      &lt;token key="pmTRANSFER"        value="${pm_TRANSFER_NAME}"/&gt;
                      &lt;token key="PROXYJARNAME"       value="${PROXY_JAR_NAME}"/&gt;
                      &lt;token key="PROXYCLIENTJARNAME" value="${PROXY_CLIENT_JAR_NAME}"/&gt;
                      &lt;token key="PROXYLIBSDIR"       value="${leis-dir}/JARS/"/&gt;
                 &lt;/replacetokens&gt;
          &lt;/filterchain&gt;
      &lt;/copy&gt;
  
       &lt;ant antfile="build.xml" target="clean" dir="${leis-dir}/proxy" inheritAll="false" /&gt;
      &lt;ant antfile="build.xml" target="prod-dist" dir="${leis-dir}/proxy" inheritAll="false"&gt;
          &lt;property name="build.name" value="${pm_MAJOR_VERSION}.${BUILD_NUM}"/&gt;
      &lt;/ant&gt;
  
       &lt;ear destfile="${ear-name}" appxml="LEIS/application.xml"&gt;
          &lt;metainf dir="${leis-dir}/LEIS/conf/EAR/META-INF" includes="weblogic-application.xml"/&gt;
          &lt;fileset dir="${leis-dir}/JARS/"                   includes="*.jar"/&gt;
          &lt;fileset dir="${leis-dir}/JARS/"                   includes="APP-INF/**" excludes="APP-INF/lib/wlfullclient.jar"/&gt;
      &lt;/ear&gt;
  
      &lt;!-- Place the proxy-client jar in the pm ear--&gt;
      &lt;zip update="true" destfile="${pm-dir}/pm2/deploy/dist/pm-main.ear"&gt;
          &lt;zipfileset dir="${leis-dir}/proxy/dist/" includes="${proxy-client-name}" fullpath="APP-INF/lib/${proxy-client-name}"/&gt;
      &lt;/zip&gt;
  
  &lt;/target&gt;
  
  &lt;target name="build-cpc"&gt;
      &lt;copy file="${pm-dir}/pm2/deploy/lib/${pm_TRANSFER_NAME}" todir="${leis-dir}/cpc-web-app/webapp/lib/cpc"/&gt;
      &lt;ant antfile="build.xml" target="build-all-environments" dir="${leis-dir}/cpc-web-app/webapp" inheritAll="false"/&gt;
  &lt;/target&gt;
  
  &lt;target name="build-all"&gt;
      &lt;antcall target="build-LEIS-components"/&gt;
      &lt;antcall target="build-pm"/&gt;
      &lt;antcall target="build-proxy"/&gt;
      &lt;antcall target="build-cpc"/&gt;
  &lt;/target&gt;    &lt;/condition&gt;
  
  &lt;condition property="build-LEIS"&gt;
      &lt;equals arg1="True" arg2="${BUILD_LEIS}" /&gt;
  &lt;/condition&gt;
  
  
  &lt;target name="build-LEIS-components" if="build-LEIS"&gt;
  
      &lt;!--Go through and build the LEIS modules--&gt;
      &lt;ant antfile="build.xml"
           target="clean"
           dir="${leis-dir}/LEIS"
           inheritAll="false"/&gt;
      &lt;ant antfile="build.xml"
           target="ejbdoclet"
           dir="${leis-dir}/LEIS/BusinessServices"
           inheritAll="false"/&gt;
      &lt;ant antfile="build.xml"
           target="jar"
           dir="${leis-dir}/LEIS"
           inheritAll="false"/&gt;
  
  
  
      &lt;ant antfile="build.xml"
           target="clean"
           dir="${leis-dir}/ETS/trunk/Entitlements"
           inheritAll="false"/&gt;
      &lt;ant antfile="build.xml"
           target="build"
           dir="${leis-dir}/ETS/trunk/Entitlements"
           inheritAll="false"/&gt;
  
  
      &lt;mkdir dir="${leis-dir}/JARS/APP-INF/lib/"/&gt;
  
  
      &lt;jar jarfile="${leis-dir}/JARS/APP-INF/lib/LEISConfig.jar"&gt;
          &lt;fileset dir="LEIS/" includes="datetime.properties"/&gt;
          &lt;fileset dir="LEIS/" includes="log4j.properties"/&gt;
          &lt;manifest&gt;
              &lt;attribute name="Built-By" value="${user.name}"/&gt;
          &lt;/manifest&gt;
      &lt;/jar&gt;
  &lt;/target&gt;
  
  
  &lt;target name="build-pm" if="build-pm"&gt;
  
  
  
      &lt;mkdir dir="${pm-dir}/amp2/deploy/propertyoverrides"/&gt;
      &lt;copy todir="${pm-dir}/amp2/deploy/propertyoverrides" overwrite="true"&gt;
          &lt;fileset dir="olwAMPconfig/propertyoverrides"/&gt;
      &lt;/copy&gt;
  
      &lt;ant antfile='${pm-dir}/amp2/build/build.xml'          target='clean-build' inheritAll="false"/&gt;
  
      &lt;!--delete the extra copy of jdo.dtd--&gt;
      &lt;delete file="jdo.dtd" /&gt;
  
      &lt;fileset id="required-amp-client-libs" dir="${pm-dir}/amp2/deploy/lib"&gt;
          &lt;include name="*.jar"/&gt;
          &lt;include name="client/*.jar"/&gt;
          &lt;exclude name="*tests.jar"/&gt;
      &lt;/fileset&gt;
  
      &lt;!-- Used to populate value of MANIFEST.MF Class-path attribute. Turns our set of "required" libs
       into a nice space separated string to place in the MANIFEST.MF. Property is used in the "dist"
       task's jar command. --&gt;
      &lt;pathconvert property="client-classpath"
                   refid="required-amp-client-libs"
                   pathsep=" "
                   dirsep="/"&gt;
          &lt;map from="${pm-dir}/amp2/deploy/lib/" to=""/&gt;
      &lt;/pathconvert&gt;
  
      &lt;jar update="true" jarfile="${pm-dir}/amp2/deploy/lib/amp-core.jar"&gt;
          &lt;manifest&gt;
              &lt;attribute name="Class-Path" value="${client-classpath}"/&gt;
              &lt;attribute name="Main-Class" value="com.retailexp.amp.ui.util.SPPClientStartUp"/&gt;
          &lt;/manifest&gt;
      &lt;/jar&gt;
  
      &lt;!-- Creates a file Marimba/BigFix/WhatEver can use to track the version of AMP installed on a machine --&gt;
      &lt;echo message="${AMP_MAJOR_VERSION}.${BUILD_NUM}" file="${pm-dir}/amp2/deploy/lib/version.txt" append="false"/&gt;
  
      &lt;!-- Remove files we place on classpath from ears, Mantis 10624 --&gt;
      &lt;!-- AMP --&gt;
      &lt;move file="${pm-dir}/amp2/deploy/dist/amp-main.ear" tofile="${pm-dir}/amp2/deploy/dist/old-amp-main.ear"/&gt;
      &lt;unzip src="${pm-dir}/amp2/deploy/dist/old-amp-main.ear" dest="${pm-dir}/amp2/deploy/dist/"&gt;
          &lt;patternset&gt;
              &lt;include name="lib/amp-server-conf.jar"/&gt;
          &lt;/patternset&gt;
      &lt;/unzip&gt;
      &lt;move file="${pm-dir}/amp2/deploy/dist/lib/amp-server-conf.jar" tofile="${pm-dir}/amp2/deploy/dist/lib/old-amp-server-conf.jar"/&gt;
      &lt;zip file="${pm-dir}/amp2/deploy/dist/lib/amp-server-conf.jar"&gt;
          &lt;zipfileset src="${pm-dir}/amp2/deploy/dist/lib/old-amp-server-conf.jar"&gt;
              &lt;exclude name="log4j.properties"/&gt;
              &lt;exclude name="ehcache-transactional.xml"/&gt;
          &lt;/zipfileset&gt;
      &lt;/zip&gt;
      &lt;zip file="${pm-dir}/amp2/deploy/dist/amp-main.ear"&gt;
          &lt;zipfileset src="${pm-dir}/amp2/deploy/dist/old-amp-main.ear"&gt;
              &lt;exclude name="lib/amp-server-conf.jar"/&gt;
          &lt;/zipfileset&gt;
          &lt;zipfileset dir="${pm-dir}/amp2/deploy/dist/lib/" includes="amp-server-conf.jar" fullpath="lib/amp-server-conf.jar"/&gt;
      &lt;/zip&gt;
      &lt;!-- EDM --&gt;
      &lt;move file="${pm-dir}/amp2/deploy/dist/amp-edm.ear" tofile="${pm-dir}/amp2/deploy/dist/old-amp-edm.ear"/&gt;
      &lt;unzip src="${pm-dir}/amp2/deploy/dist/old-amp-edm.ear" dest="${pm-dir}/amp2/deploy/dist/"&gt;
          &lt;patternset&gt;
              &lt;include name="lib/amp-server-conf.jar"/&gt;
          &lt;/patternset&gt;
      &lt;/unzip&gt;
      &lt;move file="${pm-dir}/amp2/deploy/dist/lib/amp-server-conf.jar" tofile="${pm-dir}/amp2/deploy/dist/lib/old-amp-server-conf.jar"/&gt;
      &lt;zip file="${pm-dir}/amp2/deploy/dist/lib/amp-server-conf.jar"&gt;
          &lt;zipfileset src="${pm-dir}/amp2/deploy/dist/lib/old-amp-server-conf.jar"&gt;
              &lt;exclude name="log4j.properties"/&gt;
          &lt;/zipfileset&gt;
      &lt;/zip&gt;
      &lt;zip file="${pm-dir}/amp2/deploy/dist/amp-edm.ear"&gt;
          &lt;zipfileset src="${pm-dir}/amp2/deploy/dist/old-amp-edm.ear"&gt;
              &lt;exclude name="lib/amp-server-conf.jar"/&gt;
          &lt;/zipfileset&gt;
          &lt;zipfileset dir="${pm-dir}/amp2/deploy/dist/lib/" includes="amp-server-conf.jar" fullpath="lib/amp-server-conf.jar"/&gt;
      &lt;/zip&gt;
  &lt;/target&gt;
  
  &lt;!--===============  Builds LEIS   ========================================================================--&gt;
  &lt;target name="build-proxy" if="build-LEIS"&gt;
  
  
      &lt;ant antfile="build.xml" target="clean" dir="${leis-dir}/proxy" inheritAll="false" /&gt;
      &lt;ant antfile="build.xml" target="prod-dist" dir="${leis-dir}/proxy" inheritAll="false"&gt;
          &lt;property name="build.name" value="${AMP_MAJOR_VERSION}.${BUILD_NUM}"/&gt;
      &lt;/ant&gt;
  
      &lt;!--copy the proxy jar to the LEIS jars library--&gt;
      &lt;copy todir="${leis-dir}/JARS" flatten="true"&gt;
          &lt;fileset dir="${leis-dir}/proxy/dist/" &gt;
              &lt;include name="${proxy-name}"/&gt;
          &lt;/fileset&gt;
      &lt;/copy&gt;
  
      &lt;!--create a directory to hold the LEIS ear contents--&gt;
      &lt;property name="ear.dir"            value="${leis-dir}/bin"/&gt;
      &lt;property name="ear-name"           value="${ear.dir}/LEIS_AMP.ear"/&gt;
      &lt;mkdir dir="${ear.dir}"/&gt;
  
      &lt;!--create the ear from the directories contents--&gt;
      &lt;ear destfile="${ear-name}" appxml="LEIS/application.xml"&gt;
          &lt;metainf dir="${leis-dir}/LEIS/conf/EAR/META-INF" includes="weblogic-application.xml"/&gt;
          &lt;fileset dir="${leis-dir}/JARS/"                   includes="*.jar"/&gt;
          &lt;fileset dir="${leis-dir}/JARS/"                   includes="APP-INF/**" excludes="APP-INF/lib/wlfullclient.jar"/&gt;
      &lt;/ear&gt;
  
      &lt;!-- Place the proxy-client jar in the amp ear--&gt;
      &lt;zip update="true" destfile="${pm-dir}/amp2/deploy/dist/amp-main.ear"&gt;
          &lt;zipfileset dir="${leis-dir}/proxy/dist/" includes="${proxy-client-name}" fullpath="APP-INF/lib/${proxy-client-name}"/&gt;
      &lt;/zip&gt;
  
  &lt;/target&gt;
  
  &lt;target name="build-cpc"&gt;
      &lt;copy file="${pm-dir}/amp2/deploy/lib/${AMP_TRANSFER_NAME}" todir="${leis-dir}/cpc-web-app/webapp/lib/cpc"/&gt;
      &lt;ant antfile="build.xml" target="build-all-environments" dir="${leis-dir}/cpc-web-app/webapp" inheritAll="false"/&gt;
  &lt;/target&gt;
  
  &lt;!--=========================================    Build AMP and LEIS  --!&gt;
  
  &lt;target name="build-all"&gt;
      &lt;antcall target="build-LEIS-components"/&gt;
      &lt;antcall target="build-pm"/&gt;
      &lt;antcall target="build-proxy"/&gt;
      &lt;antcall target="build-cpc"/&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p></p>