| |
从JBoss EJB的教程:创建EAR文件 |
|
File: build.xml
<?xml version="1.0"?>
<!-- ======================================================================= -->
<!-- JBoss build file -->
<!-- ======================================================================= -->
<project name="JBoss" default="ejbjar" basedir=".">
<property file="../local.properties"/> <property environment="env"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="jboss.home" value="${env.JBOSS_HOME}"/> <property name="jboss.server.config" value="default"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<!-- Build classpath -->
<path id="classpath">
<!-- So that we can get jndi.properties for InitialContext -->
<pathelement location="${basedir}"/>
<fileset dir="${jboss.home}/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${jboss.home}/server/${jboss.server.config}/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/ejb3.deployer">
<include name="*.jar"/>
</fileset>
<fileset dir="${jboss.home}/server/${jboss.server.config}/deploy/jboss-aop-jdk50.deployer">
<include name="*.jar"/>
</fileset>
<pathelement location="${build.classes.dir}"/>
</path>
<property name="build.classpath" refid="classpath"/>
<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
</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"/>
</javac>
</target>
<target name="ejbjar" depends="compile">
<jar jarfile="build/tutorial.jar">
<fileset dir="${build.classes.dir}">
<include name="org/jboss/tutorial/ear/bean/*.class"/>
</fileset>
</jar>
<zip zipfile="build/tutorial.war">
<zipfileset dir="${build.classes.dir}" prefix="WEB-INF/classes">
<include name="org/jboss/tutorial/ear/servlet/*.class"/>
</zipfileset>
<zipfileset dir=".">
<include name="calculator.jsp"/>
</zipfileset>
<zipfileset dir="resources" prefix="WEB-INF">
<include name="web.xml"/>
<include name="jboss-web.xml"/>
</zipfileset>
</zip>
<zip zipfile="build/tutorial.ear">
<zipfileset dir="build">
<include name="tutorial.war"/>
</zipfileset>
<zipfileset dir="resources" prefix="META-INF">
<include name="application.xml"/>
</zipfileset>
<zipfileset dir="build">
<include name="tutorial.jar"/>
</zipfileset>
</zip>
<copy file="build/tutorial.ear" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
</target>
<!-- =================================================================== -->
<!-- Cleans up generated stuff -->
<!-- =================================================================== -->
<target name="clean.db">
<delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
<delete file="${jboss.home}/server/${jboss.server.config}/deploy/tutorial.ear"/>
</target>
</project>
|
|
jboss-EJB-3.0_RC9_Patch_1.zip( 10,289 k) |
Related examples in the same category |
|