ant编译没有显示的类

时间:2018-05-04 15:27:15

标签: xml ant

我知道以前曾经问过这个问题,我看过其他人并且无法发现问题。所以yea ant说构建成功并且重新创建了java包中的文件层次结构。我可以确认.java文件位于src文件夹中。这是我的build.xml:

<project name="FlashcardShark" default="compile" basedir=".">

<property file="build.properties"/>
<property file="${user.home}/build.properties"/>

<property name="app.name"      value="FlashcardShark"/>
<property name="app.path"      value="/${app.name}"/>
<property name="app.version"   value="0.1"/>
<property name="build.home"    value="${basedir}/build"/>
<property name="catalina.home" value="/usr/share/tomcat7"/>
<property name="dist.home"     value="${basedir}/dist"/>
<property name="docs.home"     value="${basedir}/docs"/>
<property name="manager.url"   value="http://localhost:8080/manager/text"/>
<property name="src.home"      value="${basedir}/src"/>
<property name="web.home"      value="${basedir}/web"/>

 <path id="compile.classpath">
    <pathelement location="${basedir}/lib/*"/>

    <fileset dir="${catalina.home}/bin">      
    <include name="*.jar"/>
    </fileset>

    <pathelement location="${catalina.home}/lib"/>
    <fileset dir="${catalina.home}/lib">
      <include name="*.jar"/>
    </fileset>

    <pathelement path = "${env.J2EE_HOME}/${j2ee.jar}"/>
    <fileset dir = "lib">
      <include name = "**/*.jar"/>
    </fileset>

</path>


 <taskdef resource="org/apache/catalina/ant/catalina.tasks"
           classpathref="compile.classpath"/>


<property name="compile.debug"       value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize"    value="true"/>


<target name="all" depends="clean,compile"
   description="Clean build and dist directories, then compile"/>


<target name="clean"
   description="Delete old build and dist directories">
    <delete dir="${build.home}"/>
    <delete dir="${dist.home}"/>
</target>


<target name="compile" depends="prepare"
   description="Compile Java sources">

    <!-- Compile Java classes as necessary -->
    <mkdir    dir="${build.home}/WEB-INF/classes"/>
    <echoxml>
    <javac srcdir="${src.home}"
          destdir="${build.home}/WEB-INF/classes"
            debug="${compile.debug}"
           includes="${basedir}/lib/**/*"
      deprecation="${compile.deprecation}"
         optimize="${compile.optimize}"
    failonerror="true">
    </javac></echoxml>

    <!-- Copy application resources -->
    <copy  todir="${build.home}/WEB-INF/classes">
      <fileset dir="${src.home}" excludes="**/*.java"/>
    </copy>

  </target>


<target name="dist" depends="compile,javadoc"
   description="Create binary distribution">

    <!-- Copy documentation subdirectories -->
    <mkdir   dir="${dist.home}/docs"/>
    <copy    todir="${dist.home}/docs">
      <fileset dir="${docs.home}"/>
    </copy>

    <!-- Create application JAR file -->
    <jar jarfile="${dist.home}/${app.name}-${app.version}.war"
         basedir="${build.home}"/>

    <!-- Copy additional files to ${dist.home} as necessary -->

  </target>



<target name="prepare">
    <mkdir  dir="${build.home}"/>
    <mkdir  dir="${build.home}/WEB-INF"/>
    <mkdir  dir="${build.home}/WEB-INF/classes"/>

    <copy todir="${build.home}">
      <fileset dir="${web.home}"/>
    </copy>

    <mkdir  dir="${build.home}/WEB-INF/lib"/>
  </target>

</project>

来自ant -verbose的输出:

parsing buildfile /var/lib/tomcat7/webapps/FlashcardShark/build.xml with URI = file:/var/lib/tomcat7/webapps/FlashcardShark/build.xml
Project base dir set to: /var/lib/tomcat7/webapps/FlashcardShark
parsing buildfile jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
 [property] Loading /var/lib/tomcat7/webapps/FlashcardShark/build.properties
 [property] Loading /root/build.properties
 [property] Unable to find property file: /root/build.properties
Override ignored for property "app.path"
Override ignored for property "catalina.home"
adding /var/lib/tomcat7/webapps/FlashcardShark/lib/* which contains wildcards and may not do what you intend it to do depending on your OS or version of Java
Trying to override old definition of datatype resources
Build sequence for target(s) `compile' is [prepare, compile]
Complete build sequence is [prepare, compile, reload, install, remove, list, javadoc, clean, dist, all, ]

prepare:
    [mkdir] Skipping /var/lib/tomcat7/webapps/FlashcardShark/build because it already exists.
    [mkdir] Skipping /var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF because it already exists.
    [mkdir] Skipping /var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF/classes because it already exists.
     [copy] No sources found.
     [copy]  omitted as /var/lib/tomcat7/webapps/FlashcardShark/build is up to date.
    [mkdir] Skipping /var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF/lib because it already exists.

compile:
    [mkdir] Skipping /var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF/classes because it already exists.
<?xml version="1.0" encoding="UTF-8"?>
<javac debug="true" deprecation="false" destdir="/var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF/classes" failonerror="true" includes="/var/lib/tomcat7/webapps/FlashcardShark/lib/**/*" optimize="true" srcdir="/var/lib/tomcat7/webapps/FlashcardShark/src" />
     [copy] No sources found.
     [copy]  omitted as /var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF/classes is up to date.
     [copy] flashcardshark omitted as /var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF/classes/flashcardshark is up to date.
     [copy] flashcardshark/bean omitted as /var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF/classes/flashcardshark/bean is up to date.
     [copy] flashcardshark/servlet omitted as /var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF/classes/flashcardshark/servlet is up to date.
     [copy] flashcardshark/utils omitted as /var/lib/tomcat7/webapps/FlashcardShark/build/WEB-INF/classes/flashcardshark/utils is up to date.

BUILD SUCCESSFUL
Total time: 0 seconds

它说它找不到build.properties但我发誓它在build.xml旁边。感谢任何想法。

0 个答案:

没有答案