EJB使用build.xml来打包编译

模板:

<?xml version="1.0"?>

<!-- ======================================================================= -->
<!-- EJB3 HelloWorld build file                                                       -->
<!-- ======================================================================= -->
<!--HelloWorld为随便去一个名称-->
<project name="HelloWorld" default="ejbjar" basedir=".."><!--( . 表示build.xml所在路径)-->

<property environment="env" />
<property name="app.dir" value="${basedir}\EjbHelloWorld" /><!--EjbHelloWorld项目名称-->
<property name="src.dir" value="${app.dir}\src" />
<!--JBOSS_HOME路径 注意:当环境变量发生改变过后要重新启动Myeclipse 才会重新去读取环境变量--->
<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>

上面只提供了build.xml在开放Ejb使用的模板

你可能感兴趣的:(EJB使用build.xml来打包编译)