Topic: 请教关于ant的build.xml文件 |
Print this page |
1.请教关于ant的build.xml文件 | Copy to clipboard |
Posted by: TopCool Posted on: 2003-06-11 12:47 先看看我得build.xml <?xml version="1.0" encoding="UTF-8" ?> <!-- An Ant build file for the JBoss Book: JBoss Administration and Development examples, version 3.0.1 --> <project name="testejb" default="build-all" basedir="."> <!-- Allow override from local properties file --> <property file=".ant.properties" /> <!-- Override with your JBoss/Web server bundle dist location --> <property name="jboss.dist" value="D:/jboss-3.0.6"/> <property name="jboss.deploy.dir" value="${jboss.dist}/server/default/deploy"/> <property name="src.dir" value="${basedir}"/> <property name="src.resources" value="${basedir}"/> <property name="build.dir" value="${basedir}/output"/> <property name="build.classes.dir" value="${build.dir}/classes"/> <path id="build.path"> <pathelement location="${jboss.dist}/client/concurrent.jar"/> <pathelement location="${jboss.dist}/client/jaas.jar"/> <pathelement location="${jboss.dist}/client/jboss-common-client.jar"/> <pathelement location="${jboss.dist}/client/jboss-client.jar"/> <pathelement location="${jboss.dist}/client/jboss-system-client.jar"/> <pathelement location="${jboss.dist}/client/jboss-j2ee.jar"/> <pathelement location="${jboss.dist}/client/jbosssx-client.jar"/> <pathelement location="${jboss.dist}/client/jmx-rmi-connector-client.jar"/> <pathelement location="${jboss.dist}/client/jnet.jar"/> <pathelement location="${jboss.dist}/client/jnp-client.jar"/> <pathelement location="${jboss.dist}/client/jsse.jar"/> <pathelement location="${jboss.dist}/client/log4j.jar"/> <pathelement location="${jboss.dist}/server/default/lib/javax.servlet.jar"/> <pathelement location="${jboss.dist}/server/default/lib/jboss.jar"/> <pathelement location="${jboss.dist}/server/default/lib/jbosssx.jar"/> <pathelement location="${jboss.dist}/lib/jboss-system.jar"/> <pathelement location="${jboss.dist}/lib/jboss-jmx.jar"/> <pathelement location="${build.classes.dir}"/> </path> <path id="client.path"> <pathelement location="${jboss.dist}/client/concurrent.jar"/> <pathelement location="${jboss.dist}/client/jaas.jar"/> <pathelement location="${jboss.dist}/client/jboss-common-client.jar"/> <pathelement location="${jboss.dist}/client/jboss-client.jar"/> <pathelement location="${jboss.dist}/client/jbossmq-client.jar"/> <pathelement location="${jboss.dist}/client/jboss-system-client.jar"/> <pathelement location="${jboss.dist}/client/jboss-j2ee.jar"/> <pathelement location="${jboss.dist}/client/jbosssx-client.jar"/> <pathelement location="${jboss.dist}/client/jboss-jsr77.jar"/> <pathelement location="${jboss.dist}/client/jmx-rmi-connector-client.jar"/> <pathelement location="${jboss.dist}/client/jnet.jar"/> <pathelement location="${jboss.dist}/client/jnp-client.jar"/> <pathelement location="${jboss.dist}/client/jcert.jar"/> <pathelement location="${jboss.dist}/client/jsse.jar"/> <pathelement location="${jboss.dist}/client/log4j.jar"/> <pathelement location="${build.classes.dir}"/> <pathelement location="${src.resources}"/> </path> <!-- Validate the jboss.dist value by looking for a the client/jboss-j2ee.jar jar --> <target name="validate"> <available property="classpath_id" value="build.path" file="${jboss.dist}/client/jboss-j2ee.jar" /> </target> <target name="fail_if_not_valid" unless="classpath_id"> <fail message="jboss.dist=${jboss.dist} is not a valid JBoss dist directory"/> </target> <target name="init" depends="validate,fail_if_not_valid"> <property name="classpath" refid="${classpath_id}" /> <echo message="Using jboss.dist=${jboss.dist}" /> </target> <!-- Compile all java source under src/main --> <target name="compile" depends="init"> <mkdir dir="${build.classes.dir}"/> <javac srcdir="${src.dir}" destdir="${build.classes.dir}" classpathref="${classpath_id}" debug="on" deprecation="on" optimize="off"> <include name="**" /> </javac> </target> <target name="build-all" depends="compile"> <ant antfile="src/build.xml" /> </target> </project> 另一个build.xml <!-- Build script for the chapter 7 examples --> <project name="testejb build" default="build-all"> <property name="src.root" value="src" /> <property name="chapter.dir" value="${build.dir}/chap7" /> <target name="prepare"> <mkdir dir="${chapter.dir}" /> </target> <target name="build-all"> <antcall target="testejb-jar" /> <copy file="${chapter.dir}/testejb.jar" todir="${jboss.deploy.dir}" overwrite="true" /> <sleep seconds="1"/> </target> <target name="testejb-rar" depends="prepare"> <jar jarfile="${chapter.dir}/testejb.jar"> <fileset dir="${build.classes.dir}"/> </jar> </target> <target name="testejb-jar" depends="prepare"> <jar jarfile="${chapter.dir}/testejb.jar"> <metainf dir="${src.root}" includes="*.xml"/> <fileset dir="${build.classes.dir}" includes="**"/> </jar> </target> <target name="test" depends="testejb-jar"> <copy file="${chapter.dir}/testejb.jar" todir="${jboss.deploy.dir}" overwrite="true" /> <echo message="Waiting for deploy..." /> </target> </project> 不知道为什么是两个,可以和成一个么?这两个是我看着例子改的 我觉得应该是一个build.xm文件 就是用ant生成jboss的ejb的.jar文件用的。 另外,我想问一下怎么知道都有什么属性,我想加一个<java target....> 可是用ant编译的时候,说java没有这个属性,那我怎么知道都有什么属性那? 谢谢回答 |
2.Re:请教关于ant的build.xml文件 [Re: TopCool] | Copy to clipboard |
Posted by: ww77721 Posted on: 2003-06-11 16:02 当然可以合成一个,具体每个 target 都有哪些属性你可以看 ant 的帮助文档,或者在 eclipse 中输入那个 target 的标签后,可用的属性会自动列出来供你选择 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |