通过ANT提高EJB应用的开发效率--build.xml

<?xml version="1.0"?>

<!-- ======================================================================= -->
<!-- EJB3 HelloWorld build file                                                       -->
<!-- ======================================================================= -->

<project name="HelloWorld" default="ejbjar" basedir="..">

<property environment="env" />
<property name="app.dir" value="${basedir}\HelloWorld" />
<property name="src.dir" value="${app.dir}\src" />
<property name="jboss.home" value="${env.JBOSS_HOME}" />
<property name="jboss.server.config" value="default" />
<property name="build.dir" value="${app.dir}\build" />
<property name="build.classes.dir" value="${build.dir}\classes" />

<!-- Build classpath -->
<path id="build.classpath">
   <fileset dir="${jboss.home}\client">
    <include name="*.jar" />
   </fileset>
   <pathelement location="${build.classes.dir}" />
</path>

<!-- =================================================================== -->
<!-- Prepares the build directory                                        -->
<!-- =================================================================== -->
<target name="prepare" depends="clean">
   <mkdir dir="${build.dir}" />
   <mkdir dir="${build.classes.dir}" />
</target>

<!-- =================================================================== -->
<!-- Compiles the source code                                            -->
<!-- =================================================================== -->
<target name="compile" depends="prepare" description="编绎">
   <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="on" deprecation="on" optimize="off" includes="com/**">
    <classpath refid="build.classpath" />
   </javac>
</target>

<target name="ejbjar" depends="compile" description="创建EJB发布包">
   <jar jarfile="${app.dir}\HelloWorld.jar">
    <fileset dir="${build.classes.dir}">
     <include name="com/**/*.class" />
    </fileset>
   </jar>
</target>

<target name="deploy" depends="ejbjar">
   <copy file="${app.dir}\HelloWorld.jar" todir="${jboss.home}\server\${jboss.server.config}\deploy" />
</target>

<!-- =================================================================== -->
<!-- Cleans up generated stuff                                           -->
<!-- =================================================================== -->
<target name="clean">
   <delete dir="${build.dir}" />
   <delete file="${jboss.home}\server\${jboss.server.config}\deploy\HelloWorld.jar" />
</target>

</project>

你可能感兴趣的:(xml,ant,ejb,UP)