无报错

跟eclipse编译出来的结果比较
build\classes\
下面完全没东西...
WEB-INF\classes就正常这是我的代码build.xml
<?xml version="1.0" encoding="UTF-8"?>

<project name="${project.name}" default="deploywar" basedir="."> <property file="build.properties" />
<property name="lib.home" value="${basedir}" />
<property environment="env" />
<property name="java.home" value="${env.JAVA_HOME}" />
<property name="ant.home" value="${env.ANT_HOME}" />
<property name="build.encoding" value="UTF-8"/>  

<!-- All Jars in /lib -->
<path id="compile.classpath">
<fileset dir="${src.lib}">
<include name="*.jar" />
</fileset>
<!-- All Jars in /tomcatlib -->
<fileset dir="${tomcat.lib}">
<include name="*.jar" />
</fileset>
</path>

<!-- test environment variables -->
<target name="test" description="description">
<echo message="project.name=${project.name}" />
<echo message="java.home=${java.home}" />
<echo message="ant.home=${ant.home}" />
<echo message="appserver.home=${appserver.home}" />
<echo message="deploy.path=${deploy.path}" />
<echo message="tomcat.manager.url=${tomcat.manager.url}" />
<echo message="tomcat.manager.username=${tomcat.manager.username}" />
<echo message="tomcat.manager.password=${tomcat.manager.password}" />
<echo message="build.home=${build.home}" />
<echo message="src.webroot=${src.webroot}" />
<echo message="build.web-inf=${build.web-inf}" />
<echo message="build.class=${build.class}" />
<echo message="build.lib=${build.lib}" />
<echo message="src.home=${src.home}" />
<echo message="src.res=${src.res}" />
<echo message="src.lib=${src.lib}" />
<echo message="src.web-inf=${src.web-inf}" />
<echo message="deploy.home=${deploy.home}" />
<echo message="cache.home=${cache.home}" />
</target>
<!-- clean /tomcat/deploy -->
<target name="clean" description="description">
<delete dir="${deploy.home}" failonerror="false" />
<delete dir="${build.home}" failonerror="false" />
<delete file="${deploy.path}/${project.name}.war" failonerror="false" />
</target>

<!-- initiate directories inherit clean -->
<target name="init" depends="clean">
<mkdir dir="${build.home}" />
<mkdir dir="${build.web-inf}" />
<mkdir dir="${build.class}" />
<mkdir dir="${build.lib}" />
</target>
<target name="prepare" depends="init">
<copy todir="${build.home}">
<fileset dir="${src.webroot}" />
</copy>
</target>

<!-- compile -->
<target name="compile" depends="prepare">
<echo message="start compile!" />
<javac srcdir="${src.home}" destdir="${build.class}" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="$compile.optimize}">
<classpath refid="compile.classpath" />
</javac>
<copy todir="${build.class}">
<fileset dir="${src.res}">
<include name="**" />
</fileset>
</copy>
<echo message="complete compile!" />
</target>

<!-- deploy -->
<target name="deploy" depends="compile">
<mkdir dir="${deploy.home}" />
<copy todir="${deploy.home}">
<fileset dir="${build.home}" />
</copy>
<echo message="Successful Deployment" />
</target>

<!-- undeploy -->
<target name="undeploy">  
<delete dir="${deploy.home}" />  
<delete dir="${cache.home}" />  
<echo message="Successful UnDeployment" />  
</target>

<!-- warwarwar!! -->
<target name="deploywar" depends="compile" description="deploy the app as the war">
<war destfile="${deploy.path}/${project.name}.war" webxml="${build.web-inf}/web.xml">  
<fileset dir="${build.home}">  
<include name="**/*.*" />  
</fileset>  
</war>  
</target>  

<!-- jarjarjar! -->
<target name="jar" depends="compile" description="make .jar file">  
<delete dir="${doc.home}" />  
<mkdir dir="${doc.home}" />  
<jar destfile="${doc.home}/${project.name}.jar" basedir="${build.class}">  
<manifest>  
<attribute name="Specification-Title" value="${project.name}-${doc.title}" />  
<attribute name="Created-By" value="吴移风" />  
<attribute name="Specification-Version" value="${app.version}" />  
<attribute name="Specification-Vendor" value="${doc.vendor}" />  
</manifest>  
</jar>  
</target>  

<!-- tomcat task -->
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask">  
<classpath>  
<path location="${appserver.home}/lib/catalina-ant.jar" />  
</classpath>  
</taskdef>  
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">  
<classpath>  
<path location="${appserver.home}/lib/catalina-ant.jar" />  
</classpath>  
</taskdef>  
<taskdef name="list" classname="org.apache.catalina.ant.ListTask">  
<classpath>  
<path location="${appserver.home}/lib/catalina-ant.jar" />  
</classpath>  
</taskdef>  
<taskdef name="start" classname="org.apache.catalina.ant.StartTask">  
<classpath>  
<path location="${appserver.home}/lib/catalina-ant.jar" />  
</classpath>  
</taskdef>  
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask">  
<classpath>  
<path location="${appserver.home}/lib/catalina-ant.jar" />  
</classpath>  
</taskdef>  
<target name="install" description="install the application in Tomcat">  
<install url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${project.name}" war="${project.name}" />  
</target>  
<target name="reload" description="reload the application in Tomcat">  
<reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="${project.name}" />  
</target>  
<target name="list" description="list All the application in Tomcat">  
<list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />  
</target>  
<target name="start" description="start the application in Tomcat">  
<start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${project.name}" />  
</target>  
<target name="stop" description="stop the application in Tomcat">  
<stop url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/PiccSystem" />  
</target>      <target name="start-tomcat-E">  
        <exec executable="cmd" dir="${appserver.home}/bin">  
            <arg value="/c" />  
            <arg value="startup.bat" />  
        </exec>  
    </target>  
  
<!-- start tomcat -->
<target name="stop-tomcat-E">  
<exec executable="cmd " dir="${appserver.home}/bin" spawn="true">  
<arg value="/c" />  
<arg value="shutdown.bat" />  
</exec>  
</target>  
  
<target name="start-tomcat-D">  
<exec executable="cmd" dir="${casserver.home}/bin">  
<arg value="/c" />  
<arg value="startup.bat" />  
</exec>  
</target>  
  
<target name="stop-tomcat-D">  
<exec executable="cmd " dir="${casserver.home}/bin" spawn="true">  
<arg value="/c" />  
<arg value="shutdown.bat" />  
</exec>  
</target>  
  
</project>WHY?

解决方案 »

  1.   

    <javac srcdir="${src.home}" destdir="${build.class}" debug="${compile.debug}" deprecation="${compile.deprecation}" optimize="$compile.optimize}">
    src.home 介是个啥?
    build.class 介是个啥?
      

  2.   

    project.name=TRMS
    #----------------------------------------------------------
    appserver.home=D:/apache-tomcat-6.0.29
    casserver.home=D:/apache-tomcat-6.0.29
    deploy.path=D:/apache-tomcat-6.0.29/webapps
    tomcat.manager.url=http://localhost:8080/manager
    tomcat.manager.username=root
    tomcat.manager.password=root
    build.home=build #------
    app.version=1.0 build.web-inf=build/WEB-INF
    build.class=build/WEB-INF/classes
    build.lib=build/WEB-INF/lib 
    src.webroot=WebContent
    src.home=src
    src.res=src
    src.lib=WebContent/WEB-INF/lib
    src.web-inf=WebContent/WEB-INF
    tomcat.lib=D:/apache-tomcat-6.0.29/lib
    deploy.home=D:/apache-tomcat-6.0.29/webapps/TRMS
    cache.home=D:/apache-tomcat-6.0.29/work/Catalina/localhost compile.debug=true
    compile.deprecation=false
    compile.optimize=true回楼上build.properties
      

  3.   

    我没有看到你建立了build/classes这个路径啊,你的build.home=build; build.class=build/WEB-INF/classes同时你的javac只是将你的编译文件放到了build.class下,没有什么操作是放到build/classes下的啊!
      

  4.   

    sgyyz对哦!
    那应该怎么弄classes的....
      

  5.   

    编译完了再copy到这个目录下就对了三
    <copy todir="${build.home}\classes">
    <fileset dir="${build.class}">
    <include name="**" />
    </fileset>
    </copy>
      

  6.   


    改了之后还发现一个问题(最重要的)
    在classes文件夹下面,与eclipse生成的war包比较
    少了/ormappings,/spring,/struts
    还有一堆.properties和.xml文件
      

  7.   

    这些东西在打包的时候<include>进去就OK了啊!其实这个打包,结构就有你自己定,需要哪些就把那些东西include就OK了啊!