用eclipse开发时,生成的webcontent,不能直接放在tomcat服务器中,需要用ant进行转换。
在项目中,新建build.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project default="compile" name="gst_scheduler" basedir=".">
<property name="src.dir" value="${basedir}/src" />
<property name="dist.dir" value="D:/gst/gst_scheduler" />
<property name="dist.class.dir" value="D:/gst/gst_scheduler/WEB-INF/classes" />
<property name="dist.lib.dir" value="D:/gst/gst_scheduler/WEB-INF/lib" />
<property name="tomcat.dir" value="D:\ww\tomcat\apache-tomcat-6.0.43\lib" />
<path id="libraries">
<fileset dir="${dist.lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${tomcat.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="compile" depends="copy-resources">
<javac encoding="UTF-8" srcdir="${src.dir}"
destdir="${dist.class.dir}"
classpathref="libraries" includeantruntime="on" debug="true"/>
</target>
<target name="copy-resources" depends="clean">
<copy todir="${dist.dir}">
<fileset dir="${basedir}/WebContent">
</fileset>
</copy>
<copy todir="${dist.class.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.java" />
</fileset>
</copy>
</target>
<target name="clean" >
<delete dir="${dist.dir}" />
<mkdir dir="${dist.dir}" />
</target>
</project>
右键build.xml,以ant运行,即可生成myeclipse中的那种webroot文件夹。