Version 2
    <?xml version="1.0"?>
    
    <!-- ======================================================================= -->
    <!-- JBoss build file                                                       -->
    <!-- ======================================================================= -->
    
    <project name="JBoss" default="ejbjar" basedir=".">
    
       <property file="../local.properties"></property>  <property environment="env"></property>
       <property name="src.dir" value="${basedir}/src"></property>
       <property name="jboss.home" value="${env.JBOSS_HOME}"></property>   
       <property name="jboss.server.config" value="default"></property>
       <property name="build.dir" value="${basedir}/build"></property>
       <property name="build.classes.dir" value="${build.dir}/classes"></property>
       <property name="tmp.dir" value="${basedir}/tmp"></property>
    
       <!-- Build classpath -->
       <path id="classpath">
          <pathelement location="${basedir}"></pathelement>
          <fileset dir="${jboss.home}/lib">
             <include name="**/*.jar"></include>
          </fileset>
          <fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
             <include name="**/*.jar"></include>
          </fileset>
          <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/ejb3.deployer">
             <include name="*.jar"></include>
          </fileset>
          <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/jboss-aop-jdk50.deployer">
             <include name="*.jar"></include>
          </fileset>
          <pathelement location="${build.classes.dir}"></pathelement>
          <!-- So that we can get jndi.properties for InitialContext -->
       </path>
    
       <property name="build.classpath" refid="classpath"></property>
    
       <!-- =================================================================== -->
       <!-- Prepares the build directory                                        -->
       <!-- =================================================================== -->
       <target name="prepare">
          <mkdir dir="${build.dir}"></mkdir>
          <mkdir dir="${build.classes.dir}"></mkdir>
              <mkdir dir="${tmp.dir}"></mkdir>
       </target>
    
       <!-- =================================================================== -->
       <!-- Compiles the source code                                            -->
       <!-- =================================================================== -->
       <target name="compile" depends="prepare">
          <javac srcdir="${src.dir}"
             destdir="${build.classes.dir}"
             debug="on"
             deprecation="on"
             optimize="off"
             includes="**">
             <classpath refid="classpath"></classpath>
          </javac>
       </target>
    
       <target name="ejbjar" depends="compile">
          <jar jarfile="build/tutorial.jar">
             <fileset dir="${build.classes.dir}">
                <include name="**/*.class"></include>
             </fileset>
             <fileset dir=".">
                <!--include name="ssl-service.xml"/-->
                <!--include name="localhost.keystore"/-->
                <include name="*.properties"></include>
             </fileset>
          </jar>
              <copy file="localhost.keystore" todir="${jboss.home}/server/${jboss.server.config}/conf"></copy>
              <copy file="localhost.truststore" todir="${jboss.home}/server/${jboss.server.config}/conf"></copy>
          <copy file="build/tutorial.jar" todir="${jboss.home}/server/${jboss.server.config}/deploy"></copy>
              <copy todir="${tmp.dir}" filtering="yes">
                      <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy">
                         <include name="ejb3.deployer/**"></include>
                      </fileset>
                      <fileset dir="${jboss.home}/server/${jboss.server.config}/deploy">
                         <include name="jboss-web.deployer/**"></include>
                      </fileset>
              </copy>
              <copy todir="${jboss.home}/server/${jboss.server.config}/deploy" filtering="yes" overwrite="true">
                 <fileset dir=".">
                    <include name="ejb3.deployer/**"></include>
                 </fileset>
                 <fileset dir=".">
                     <include name="jboss-web.deployer/**"></include>
                 </fileset>
                 <fileset dir=".">
                     <include name="servlet-invoker.war/**"></include>
                 </fileset>
              </copy>
       </target>
    
       <target name="run">
          <java classname="org.jboss.tutorial.http_https.client.Client" fork="yes" dir=".">
             <jvmarg line="-Djavax.net.ssl.trustStore=${jboss.home}/server/${jboss.server.config}/conf/localhost.truststore -Djavax.net.ssl.trustStorePassword=opensource -Djava.protocol.handler.pkgs=javax.net.ssl"></jvmarg>
             <classpath refid="classpath"></classpath>
          </java>
       </target>
    
       <!-- =================================================================== -->
       <!-- Cleans up generated stuff                                           -->
       <!-- =================================================================== -->
       <target name="clean.db">
          <delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"></delete>
       </target>
    
       <target name="clean">
          <copy todir="${jboss.home}/server/${jboss.server.config}/deploy" filtering="yes" overwrite="true">
                 <fileset dir="${tmp.dir}">
                        <include name="ejb3.deployer/**"></include>
                     </fileset>
                     <fileset dir="${tmp.dir}">
                        <include name="jboss-web.deployer/**"></include>
                     </fileset>
              </copy>
              <delete dir="${tmp.dir}"></delete>
          <delete dir="${build.dir}"></delete>
          <delete file="${jboss.home}/server/${jboss.server.config}/deploy/tutorial.jar"></delete>
              <delete file="${jboss.home}/server/${jboss.server.config}/conf/localhost.keystore"></delete>
              <delete file="${jboss.home}/server/${jboss.server.config}/conf/localhost.truststore"></delete>
              <delete dir="${jboss.home}/server/${jboss.server.config}/deploy/servlet-invoker.war"></delete>
       </target>
    
    
    </project>