maven web app目录结构对应的build.xml

maven ant插件生成的build.xml还是会依赖maven

我在maven生成的build.xml上改了改,去掉了maven依赖:

<?xml version="1.0" encoding="UTF-8"?>


<project name="showcase" default="war" basedir=".">

	<!-- ====================================================================== -->
	<!-- Build environment properties                                           -->
	<!-- ====================================================================== -->

	<property file="build.properties"/>
	<property name="build.finalName" value="showcase"/>
	<property name="build.dir" value="target"/>
	<property name="build.outputDir" value="${build.dir}/classes"/>
	<property name="build.srcDir" value="src/main/java"/>
	<property name="build.resourceDir" value="src/main/resources"/>

	<!-- ====================================================================== -->
	<!-- Defining classpaths                                                    -->
	<!-- ====================================================================== -->

	<path id="build.classpath">
		<fileset dir="compile-lib">
			<include name="*.jar"/>
		</fileset>
		<fileset dir="lib">
			<include name="*.jar"/>
		</fileset>

	</path>


	<!-- ====================================================================== -->
	<!-- Cleaning up target                                                     -->
	<!-- ====================================================================== -->

	<target name="clean" description="Clean the output directory">
		<delete dir="${build.dir}"/>
	</target>

	<!-- ====================================================================== -->
	<!-- Compilation target                                                     -->
	<!-- ====================================================================== -->

	<target name="compile"  description="Compile the code">
		<mkdir dir="${build.outputDir}"/>
		<javac destdir="${build.outputDir}" 
			nowarn="false" 
			debug="true" 
			optimize="false" 
			deprecation="true" 
			target="1.6" 
			verbose="false" 
			fork="false" 
			source="1.6">
			<src>
				<pathelement location="${build.srcDir}"/>
			</src>
			<classpath refid="build.classpath"/>
		</javac>
		<copy todir="${build.outputDir}">
			<fileset dir="${build.resourceDir}"/>
		</copy>
	</target>



	<!-- ====================================================================== -->
	<!-- Package target                                                         -->
	<!-- ====================================================================== -->

	<target name="package" depends="compile" description="Package the application">
		<mkdir dir="${build.dir}/${build.finalName}/WEB-INF/lib"/>
		<war destfile="${build.dir}/${build.finalName}.war" 
			compress="true" 
			webxml="src/main/webapp/WEB-INF/web.xml">
			<lib dir="lib"/>
			<classes dir="${build.outputDir}"/>
			<fileset dir="src/main/webapp" 
				excludes="WEB-INF/web.xml"/>
		</war>
	</target>

	<!-- ====================================================================== -->
	<!-- A dummy target for the package named after the type it creates         -->
	<!-- ====================================================================== -->

	<target name="war" depends="package" description="Builds the war for the application"/>


</project>


Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.