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

📄 build.xml

📁 贷款实例
💻 XML
字号:
<?xml version="1.0"?>
<project default="all" name="Loan Payment Processing GT4 buildfile" basedir=".">
	<description>
        Loan Payment Processing GT4 buildfile
    </description>

	<!-- Define the environment variable -->
	<property environment="env" />

	<!-- 
	Properties in these files will override the properties defined in this file.
    -->
	<property file="build.properties" />
	<property file="${user.home}/build.properties" />

	
	
	
	<!-- Directory where GT4 is installed --> 
	<!-- Note that the buildfile requires an environment variable GLOBUS_LOCATION
	     pointing to that directory -->
	<property name="globus.location" location="${env.GLOBUS_LOCATION}" />
	
		
		
	<!-- GT4 build files and directories-->
	<property name="build.packages" location="${globus.location}/share/globus_wsrf_common/build-packages.xml" />
	<property name="build.stubs" location="${globus.location}/share/globus_wsrf_tools/build-stubs.xml" />
	<property name="schema.src" location="${globus.location}/share/schema" />

	
	
	<!-- Important directories and files -->
	<property name="src.dir" value="." />
	<property name="etc.dir" value="${src.dir}/${package.dir}/etc" />
	<property name="mappings.file" value="${src.dir}/namespace2package.mappings" />

	
	
	
	<!-- Name of the GAR file that will be generated -->
	<property name="gar.name" value="${gar.filename}.gar" />
	
	
	
	<!-- Name of the JAR files to be generated -->
	<property name="jar.name" value="${gar.filename}.jar" />
	<property name="stubs.jar.name" value="${gar.filename}_stubs.jar" />

	
	
	<!-- Build directories -->
	
	<!-- Auxiliary directory where all the intermediate files will be placed -->
	<property name="build.dir" location="build" />
	<!-- Directory for compiled service classes -->
	<property name="build.dest" location="${build.dir}/classes" />
	<!-- Directory for compiled JAR files (additional library files required by
	     the service will also be placed here) -->
	<property name="build.lib.dir" location="${build.dir}/lib" />
	<!-- Directory where stub source and class files are placed -->
	<property name="stubs.dir" location="${build.dir}/stubs-${gar.filename}" />
	<!-- Stub source files -->
	<property name="stubs.src" location="${stubs.dir}/src" />
	<!-- Compiled stub classes -->
	<property name="stubs.dest" location="${stubs.dir}/classes" />

	
	<!-- Global stub directories -->
	<!-- This is a hack. Once the stubs for a service have been generated and compiled,
	     the class files are copied to the global directory. This allows us to keep the
	     stub class files of each service separate (so we won't end up generating GAR
	     files that contain stub classes from services that don't belong in that GAR file).
	     The reason for later pooling them into a single directory is because it is very 
	     convenient, specially when working from an IDE (we don't need to add a new
	     class folder with each new service, we can simply add the global stub directory).
	     
	     Note, however, that the global stub directory does _not_ play any part in the
	     GAR file generation. It's simply there as a convenience.
	     
	     Again, this is a _hack_. It still beats having to run "ant clean" each time the
	     build script gets confused, but I'm sure there's a better way of doing this -->
	<property name="stubs.global.dir" location="${build.dir}/stubs" />
	<property name="stubs.global.dest" location="${stubs.global.dir}/classes" />

	
	<!-- Schema directories -->
	
	<!-- Location of our schema files -->
	<property name="schema.local" location="./schema" />
	<!-- Where we have to copy schema files inside the build directory -->
	<property name="schema.dest" location="${build.dir}/schema" />

	

	<!-- Filesets -->

	<!-- JARs to be included in the GAR file -->
	<fileset dir="${build.lib.dir}" id="garjars" />
	<property name="garjars.id" value="garjars" />

	<!-- Schema files (WSDL, XSD, etc.) to be included in the GAR file -->
	<fileset dir="${schema.dest}" id="garschema">
		<include name="${schema.path}/**/*" />
		<include name="${factory.schema.path}/**/*" />
	</fileset>
	<property name="garschema.id" value="garschema" />

	<!-- Configuration files (security, etc.) to be included in the GAR file -->
	<property name="garetc.id" value="garetc" />
	<fileset dir="${etc.dir}" id="garetc" />



	<!-- Miscellaneous properties -->
	
	<!-- This property is defined simply so we can write ${sep} instead of
	     ${file.separator}, which makes some expressions too long -->
	<property name="sep" value="${file.separator}" />
	<!-- We want detailed error messages -->
	<property name="java.debug" value="on" />
	
	
	
	<!-- Sets up the build directory structure -->
	<target name="init">
		<mkdir dir="${build.dir}" />
		<mkdir dir="${build.dest}" />
		<delete dir="${build.lib.dir}" />
		<!-- Delete build lib dir to avoid JARs from previous builds from getting into our GAR file -->
		<mkdir dir="${build.lib.dir}" />

		<mkdir dir="${stubs.dir}" />
		<mkdir dir="${stubs.src}" />
		<mkdir dir="${stubs.dest}" />

		<mkdir dir="${stubs.global.dir}" />
		<mkdir dir="${stubs.global.dest}" />

		<mkdir dir="${schema.dest}" />
		<copy toDir="${schema.dest}">
			<fileset dir="${schema.src}" casesensitive="yes">
				<include name="wsrf/**/*" />
				<include name="ws/**/*" />
			</fileset>
			<fileset dir="${schema.local}" casesensitive="yes">
				<include name="${schema.path}/*" />
				<include name="${factory.schema.path}/*" />
			</fileset>
		</copy>

		<!-- Creates etc.dir in case it doesn't exist. Has no effect if dir already exists -->
		<mkdir dir="${etc.dir}" />
	</target>

	
	<!-- "Flattens" the WSDL file. i.e. runs the WSDL Preprocessor and creates a single
	     WSDL file with all the operations and RPs in the portTypes specified in
	     the wsdlpp:extends attribute (plus, of course, those defined in our own WSDL file) -->
	<!-- Note that this is done with a GT4 tool -->
	<target name="flatten" depends="init">
		<ant antfile="${build.stubs}" target="flatten">
			<property name="source.flatten.dir" location="${schema.dest}/${schema.path}" />
			<property name="target.flatten.dir" location="${schema.dest}/${schema.path}" />
			<property name="wsdl.source" value="${interface.name}.wsdl" />
			<property name="wsdl.target" value="${interface.name}_flattened.wsdl" />
			<property name="wsdl.porttype" value="${interface.name}PortType" />
		</ant>
	</target>

	
	<!-- Same as above, but for the factory WSDL file (if any) -->
	<target name="factoryFlatten" depends="init" if="factory.schema.path">
		<ant antfile="${build.stubs}" target="flatten">
			<property name="source.flatten.dir" location="${schema.dest}/${factory.schema.path}" />
			<property name="target.flatten.dir" location="${schema.dest}/${factory.schema.path}" />
			<property name="wsdl.source" value="${factory.interface.name}.wsdl" />
			<property name="wsdl.target" value="${factory.interface.name}_flattened.wsdl" />
			<property name="wsdl.porttype" value="${factory.interface.name}PortType" />
		</ant>
	</target>

	
	<!-- Generate bindings for our WSDL file -->
	<!-- This is done with a GT4 tool -->
	<target name="generateBindings" depends="flatten">
		<ant antfile="${build.stubs}" target="generateBinding">
			<property name="source.binding.dir" value="${schema.dest}/${schema.path}" />
			<property name="target.binding.dir" value="${schema.dest}/${schema.path}" />
			<property name="porttype.wsdl" value="${interface.name}_flattened.wsdl" />
			<property name="binding.root" value="${interface.name}" />
		</ant>
	</target>

	
	<!-- Same as above, but for the factory WSDL file (if any) -->
	<target name="generateFactoryBindings" depends="factoryFlatten" if="factory.schema.path">
		<ant antfile="${build.stubs}" target="generateBinding">
			<property name="source.binding.dir" value="${schema.dest}/${factory.schema.path}" />
			<property name="target.binding.dir" value="${schema.dest}/${factory.schema.path}" />
			<property name="porttype.wsdl" value="${factory.interface.name}_flattened.wsdl" />
			<property name="binding.root" value="${factory.interface.name}" />
		</ant>
	</target>

	
	<!-- Generate the stub source files -->
	<!-- This is done with a GT4 tool -->
	<target name="stubs" depends="generateBindings">
		<!-- Merge our namespace mappings file with the GT4 mappins file -->
		<ant antfile="${build.stubs}" target="mergePackageMapping">
			<property name="mapping.src" location="${mappings.file}" />
			<property name="mapping.dst" location="${build.dir}/namespace2package.mappings" />
		</ant>
		<!-- Invoke the stub generator --> 
		<ant antfile="${build.stubs}" target="generateStubs">
			<property name="mapping.file" location="${build.dir}/namespace2package.mappings" />
			<property name="source.stubs.dir" location="${schema.dest}/${schema.path}" />
			<property name="target.stubs.dir" location="${stubs.src}" />
			<property name="wsdl.file" value="${interface.name}_service.wsdl" />
		</ant>
	</target>

	
	<!-- Same as above, but for the factory service (if any) -->
	<target name="factoryStubs" depends="generateFactoryBindings" if="factory.schema.path">
		<ant antfile="${build.stubs}" target="mergePackageMapping">
			<property name="mapping.src" location="${mappings.file}" />
			<property name="mapping.dst" location="${build.dir}/namespace2package.mappings" />
		</ant>
		<ant antfile="${build.stubs}" target="generateStubs">
			<property name="mapping.file" location="${build.dir}/namespace2package.mappings" />
			<property name="source.stubs.dir" location="${schema.dest}/${factory.schema.path}" />
			<property name="target.stubs.dir" location="${stubs.src}" />
			<property name="wsdl.file" value="${factory.interface.name}_service.wsdl" />
		</ant>

	</target>

	
	<!-- Compile the stubs generated in the previous step -->
	<target name="compileStubs" depends="stubs, factoryStubs">
		<javac srcdir="${stubs.src}" destdir="${stubs.dest}" debug="${java.debug}">
			<include name="**/*.java" />
			<classpath>
				<fileset dir="${globus.location}/lib">
					<include name="*.jar" />
					<exclude name="${stubs.jar.name}" />
					<exclude name="${jar.name}" />
				</fileset>
			</classpath>
		</javac>
		<!-- Copy compiled stubs to global stub directory (see note above) -->
		<copy toDir="${stubs.global.dest}" overwrite="true">
			<fileset dir="${stubs.dest}"/>	
		</copy>
	</target>

	
	<!-- Compile the implementation classes (service, resource, etc.) -->
	<target name="compile" depends="compileStubs">
		<javac srcdir="${src.dir}" includes="${package.dir}/**" destdir="${build.dest}" debug="${java.debug}" deprecation="${deprecation}">
			<classpath>
				<pathelement location="${stubs.dest}" />
				<fileset dir="${globus.location}/lib">
					<include name="*.jar" />
					<exclude name="${stubs.jar.name}" />
					<exclude name="${jar.name}" />
				</fileset>
			</classpath>
		</javac>
	</target>
	
	
	<!-- Create a JAR file with the implementation classes -->
	<target name="jar" depends="compile">
		<jar jarfile="${build.lib.dir}/${jar.name}" basedir="${build.dest}">
			<include name="**/${package.dir}/**" />
			<include name="**/${package.dir}/config/**" />
		</jar>
	</target>


	<!-- Create a JAR file with the stub classes -->
	<target name="jarStubs" depends="compileStubs">
		<jar destfile="${build.lib.dir}/${stubs.jar.name}" basedir="${stubs.dest}" />
	</target>

	
	<!-- Empty target, in case we simply want to generate the JAR files -->
	<!-- NOTE: This is needed by GT4IDE -->
	<target name="jars" depends="jarStubs, jar">
	</target>


	<!-- Creates the GAR file -->
	<target name="dist" depends="jarStubs, jar">
		<ant antfile="${build.packages}" target="makeGar">
			<property name="garserverdeployment.file" value="${package.dir}/deploy-server.wsdd" />
			<property name="garclientdeployment.file" value="${package.dir}/deploy-client.wsdd" />
			<property name="garclientserverdeployment.file" value="${package.dir}/deploy-client-server.wsdd" />
			<property name="garjndiconfigdeployment.file" value="${package.dir}/deploy-jndi-config.xml" />
			<reference refid="${garjars.id}" />
			<reference refid="${garschema.id}" />
			<reference refid="${garetc.id}" />
		</ant>
	</target>

	
	<!-- This target added mainly for the purposes of the GT4IDE plugin. It performs the same task as
         target "dist" except it has no dependencies, and simply assumes the following directory structure:
	 
	 build/
	    WSDD and JNDI files
	    lib/
	      JAR files
	    schema/
	      WSDL files
    -->
	<property name="garschema_nodep.id" value="garschema_nodep" />
	<fileset dir="${build.dir}/schema" id="garschema_nodep">
		<include name="**/*" />
	</fileset>

	<target name="dist_nodep">
		<mkdir dir="${build.dir}" />
		<mkdir dir="${build.lib.dir}" />
		<mkdir dir="${schema.dest}" />
		<mkdir dir="${etc.dir}" />

		<copy file="deploy-server.wsdd" toDir="${build.dir}" failonerror="false" />
		<copy file="deploy-client.wsdd" toDir="${build.dir}" failonerror="false" />
		<copy file="deploy-jndi-config.xml" toDir="${build.dir}" failonerror="false" />
		<copy file="deploy-client-server.wsdd" toDir="${build.dir}" failonerror="false" />

		<copy toDir="${build.lib.dir}" flatten="true">
			<fileset dir="." casesensitive="yes">
				<include name="*/build/lib/*.jar" />
			</fileset>
		</copy>

		<copy toDir="${build.dir}" includeEmptyDirs="false">
			<mapper type="regexp" from="^([^${sep}]+)${sep}([^${sep}]+)${sep}(.*)$$" to="\3" />
			<fileset dir="./" casesensitive="yes">
				<include name="**/build/schema/**/*" />
				<exclude name="**/build/schema/ws/**/*" />
				<exclude name="**/build/schema/wsrf/**/*" />
			</fileset>
		</copy>

		<ant antfile="${build.packages}" target="makeGar">
			<property name="garserverdeployment.file" value="${build.dir}/deploy-server.wsdd" />
			<property name="garclientdeployment.file" value="${build.dir}/deploy-client.wsdd" />
			<property name="garclientserverdeployment.file" value="${build.dir}/deploy-client-server.wsdd" />
			<property name="garjndiconfigdeployment.file" value="${build.dir}/deploy-jndi-config.xml" />
			<reference refid="${garjars.id}" />
			<reference refid="${garschema_nodep.id}" torefid="garschema" />
			<reference refid="${garetc.id}" />
		</ant>
	</target>

	
	<!-- Clean up all the intermediate files -->
	<target name="clean">
		<delete dir="tmp" />
		<delete dir="${build.dir}" />
		<delete file="${gar.name}" />
	</target>

	
	<!-- Default target "all" generates the GAR file -->
	<target name="all" depends="dist" />

</project>

⌨️ 快捷键说明

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