⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 build.xml

📁 This example application requires several components to be setup and configured before running. It
💻 XML
字号:
<!-- this file uses Apache Ant 1.5.3 beta 1 -->
<project name="Order example Ant file" default="about" basedir=".">	

	<!-- The location where your xdoclet jar files reside -->
	<property name="xdoclet.lib.home" value="c:/java_api/xdoclet-1.2/lib"/>
	
	<property name="properties.dir"   value="." />
	<property name="hibernate.lib.home" value="C:/java_api/hibernate-2.1/lib"/>
	<property name="war.webinf.home" value="C:/MyWSADProjects/OnJavaCom/WebContent/WEB-INF"/>
	<property name="mysql.lib.home" value="C:/java_api/mysql-connector-java-2.0.14"/>
	<property name="db2.lib.home" value="C:/java_api/db2java"/>
												
	<property name="tomcat.work.directory" value="C:/Program Files/Apache Group/Tomcat 4.1/work/Standalone/localhost/portal"/>

	<target name="clean" depends="init" description="removes all directories related to this build">				
		<delete dir="${src}/"/>
		<delete dir="${dist}"/>
	</target>
	
	<target name="init" description="Initializes properties that are used by other targets.">
		<tstamp/>
		<property name="src" value="src"/>
		<property name="dist" value="dist"/>		
	</target>
	
	<target name="prepare" depends="init,clean" description="creates dist directory">
		<echo message="Creating required directories..."/>				
		<mkdir dir="${src}"/>
		<mkdir dir="${dist}"/>
	</target>	
	
	<target name="hibernate-local" depends="init"
        description="Generates Hibernate class descriptor files. Use this ONLY if 
        			generating mapping files locally from WSAD structure.">
        			
		<echo message="Building Hibernate mappings..."/>

		<delete>
			<fileset dir="${war.webinf.home}\classes\com\meagle\bo" includes="**/*.hbm.xml"/>
		</delete>

		<taskdef name="hibernatedoclet"
		    classname="xdoclet.modules.hibernate.HibernateDocletTask">
		    <classpath>
		        <fileset dir="${xdoclet.lib.home}">
		            <include name="*.jar"/>
		        </fileset>
		    </classpath>
		</taskdef>
		
		<!-- Execute the hibernatedoclet task -->
	    <hibernatedoclet
	        destdir="${war.webinf.home}\classes"
	        excludedtags="@version,@author,@todo"
	        force="true"
	        verbose="true">
	    
	        <fileset dir="JavaSource">
	            <include name="**/bo/*.java"/>
	        </fileset>
	    
	        <hibernate version="2.0"/>
	        
	    </hibernatedoclet>	
	</target>	
	
	<!-- 
		To run this you will need a hibernate.properties file in your classpath with the following:
			hibernate.default_schema DB2ADMIN
			hibernate.dialect net.sf.hibernate.dialect.DB2Dialect
	-->
	<target name="db-schema" depends="hibernate-local">
	     <path id="hibernate.mapping.files" >
	           <fileset dir="${war.webinf.home}/classes">
	                <include name="com/meagle/bo/**/*.hbm.xml" />
	                <!--exclude name="**/JobEntry.hbm.xml"/>
	                <exclude name="**/JobSkill.hbm.xml"/>
	                <exclude name="**/JobNarrative.hbm.xml"/-->
	                <exclude name="**/Keyword.hbm.xml"/>	                
	            </fileset>
	     </path>
	    <pathconvert refid="hibernate.mapping.files" property="hibernate.mappings" pathsep=" "/>
	    <java classname="net.sf.hibernate.tool.hbm2ddl.SchemaExport" fork="true">
	        <!-- mapping file -->
	        <arg line="${hibernate.mappings} --text --format --output=clientportal_schema.ddl"/>
	        <classpath>	            
	            <pathelement location="${war.webinf.home}/classes"/>
	            <pathelement location="${war.webinf.home}"/>
	
	            <fileset dir="${hibernate.lib.home}">
	                <include name="**/*.jar" />
	            </fileset>	
	            
	            <fileset dir="${db2.lib.home}">
	                <include name="**/*.jar" />
	                <include name="**/*.zip" />
	            </fileset>	                        
	           
	            <fileset dir="${war.webinf.home}/lib">
					<include name="**/*.jar" />
					<include name="**/*.zip" />
	            </fileset>
	            
	            <!-- build output path -->
	            <pathelement location="${basedir}"/>
	        </classpath>
	   </java>
	</target>	
	
	
	<!-- This will use hibernate.properties in the class folder -->
	<target name="db-schema-drop" depends="hibernate-local">
		<echo message="This will drop all tables and recreate them based on the mappings generated "/>
		<echo message="by the hibernate-local target.  Please reference this file: "/>
		<echo message="${war.webinf.home}\classes\hibernate.properties "/>
		<echo message="and modify it for the correct environment before continuing."/>
		<echo message=""/>
		<input>Press Return key to continue...</input>
	
	     <path id="hibernate.mapping.files" >
	           <fileset dir="${war.webinf.home}/classes">
	                <include name="com/meagle/bo/**/*.hbm.xml" />
	            </fileset>
	     </path>
	    <pathconvert refid="hibernate.mapping.files" property="hibernate.mappings" pathsep=" "/>
	    <java classname="net.sf.hibernate.tool.hbm2ddl.SchemaExport" fork="true">
	        <!-- mapping file -->
	        <arg line="${hibernate.mappings} --format --output=clientportal_schema.ddl"/>
	        <classpath>	            
	            <pathelement location="${war.webinf.home}/classes"/>
	            <pathelement location="${war.webinf.home}/lib"/>
	
	            <fileset dir="${hibernate.lib.home}">
	                <include name="**/*.jar" />
	            </fileset>
	            
	            <fileset dir="${mysql.lib.home}">
		    	<include name="**/*.jar" />
	            </fileset> 

	            <fileset dir="${db2.lib.home}">
	                <include name="**/*.jar" />
	                <include name="**/*.zip" />
	            </fileset> 
	            
	            <fileset dir="${war.webinf.home}/lib">
					<include name="**/*.jar" />
					<include name="**/*.zip" />
	            </fileset>
	            
	            <!-- build output path -->
	            <pathelement location="${basedir}"/>
	        </classpath>
	   </java>
	</target>	
	

	<target name="about" description="about this dist file" depends="init">
		<echo message="various task for local stuff"/>
		<echo message="targets include: hibernate-local, db-schema, db-schema-drop"/>
		<echo message="hibernate-local - builds Hibernate mappings from XDoclet in source"/>
		<echo message="db-schema - builds a DDL file from the Hibernate mapping files"/>
		<echo message="db-schema-drop - same as db-schema except it will actually load the DDL into the database"/>
	</target>
</project>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -