title: How to Stop and Restart JBoss 7.1 Application Server With Ant script?
body: <p>I have a JSF project that supported with primefaces. I want to use ant script for complie and deployment operations. I created following build.xml. This Ant script is compiling and deploying project to jboss 7.1. But I could not create ant target for jboss stop and restart operation. I googled and found a ant task for old jboss version int this link: </p>
  
  <p><a href="https://stackoverflow.com/questions/3060048/how-to-start-and-stop-jboss-server-using-ant-task">How to start and stop jboss server using Ant task?</a>  </p>
  
  <p>but Jboss 7.1 does not have "shutdown.bat" and "restart.bat" anymore. </p>
  
  <p>Is there anyone who have experiences with this problem?</p>
  
  <p>Thanks.</p>
  
  <p>Build.xml:</p>
  
  <pre><code>&lt;project default="run" basedir="." name="portal"&gt;
  &lt;property environment="env"/&gt;
  &lt;property name="JBOSS_HOME" value="C:/jboss-as-7.1.1.Final"/&gt;
  &lt;property name="JBoos.deployment.dir" value="${JBOSS_HOME}/standalone/deployments"/&gt;
  &lt;property name="JBoos.bin" value="${JBOSS_HOME}/bin"/&gt;
  &lt;property name="base" value="."/&gt;
  &lt;property name="source" value="${base}/src"/&gt;
  
  &lt;target name="run" depends="clean, compile"&gt;
      &lt;war warfile="portal.war" needxmlfile = "false" &gt;
          &lt;fileset dir="${source}/main/webapp"/&gt;
          &lt;classes dir="D:/portalAnt/WEB-INF/classes"/&gt;
          &lt;lib file = "C:/MavenRepo/.m2/repository/org/primefaces/primefaces/3.5/primefaces-3.5.jar"/&gt;
          &lt;metainf dir="D:/Personel/Dropbox/Java/primeFaces_WS/portal/target/m2e-wtp/web-resources/META-INF"/&gt;
      &lt;/war&gt;
          &lt;antcall target="deployTarget"/&gt;
          &lt;antcall target="startJboss"/&gt;
  &lt;/target&gt;
  
  &lt;target name="deployTarget"&gt;
      &lt;copy file="${base}/portal.war" todir="${JBoos.deployment.dir}"/&gt;
  &lt;/target&gt;
  
  &lt;target name="startJboss"&gt;
      &lt;exec executable="${JBoos.bin}/standalone.bat"/&gt;
  &lt;/target&gt;
  
  &lt;target name="stopJboss"&gt;
  
  &lt;/target&gt;   
  
  &lt;path id="MavenLib"&gt;
       &lt;!-- Maven libs are here. --&gt;
  &lt;/path&gt;
  
  &lt;path id="JbossLib"&gt;
     &lt;!-- Jboss libs are here. --&gt;
  &lt;/path&gt;
  
  &lt;path id="portal.classpath"&gt;
      &lt;path refid="MavenLib"/&gt;
      &lt;path refid="JBossLib"/&gt;
  &lt;/path&gt;
  
  &lt;target name="compile"&gt;
      &lt;javac includeantruntime="false" srcdir="./src" destdir="D:/portalAnt/WEB-INF/classes"&gt;
          &lt;classpath refid="portal.classpath"/&gt;
      &lt;/javac&gt;
      &lt;mkdir dir="D:/portalAnt/WEB-INF/classes/META-INF"/&gt;
      &lt;copy file="${base}/src/main/resources/META-INF/persistence.xml" todir="D:/portalAnt/WEB-INF/classes/META-INF"/&gt; 
  &lt;/target&gt;
  
  &lt;target name="clean"&gt;
      &lt;delete file ="${JBoos.deployment.dir}/portal.war"/&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p></p>