Ant任务“javac”成功但不产生任何输出

时间:2014-06-20 13:36:30

标签: ant build javac

我正在尝试使用ant编译项目。我想“javac”任务是成功的,因为我可以在控制台上看到以下消息: [javac]将151源文件编译到/ var / lib / jenkins / jobs / project1 / workspace / build
这是命令“ant compile”

的完整输出
clean:
   [delete] Deleting directory /var/lib/jenkins/jobs/project1/workspace/build
   [delete] Deleting directory /var/lib/jenkins/jobs/project1/workspace/docs
   [delete] Deleting directory /var/lib/jenkins/jobs/project1/workspace/dist

makedir:
    [mkdir] Created dir: /var/lib/jenkins/jobs/project1/workspace/build
    [mkdir] Created dir: /var/lib/jenkins/jobs/project1/workspace/docs
    [mkdir] Created dir: /var/lib/jenkins/jobs/project1/workspace/dist

compile:
    [javac] /var/lib/jenkins/jobs/project1/workspace/build.xml:43: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 151 source file to /var/lib/jenkins/jobs/project1/workspace/build
BUILD SUCCESSFUL
Total time: 1 second

问题是“build”文件夹中没有产生任何内容!
我在其他项目中使用相同的build.xml模板文件,它工作得很好,但在这里我无法理解为什么我在build文件夹中找不到编译的源代码。 请帮忙。 这是我的build.xml文件:

<?xml version="1.0"?>
<project name="project1" default="main" basedir=".">
  <!-- Sets variables which can later be used. -->
  <!-- The value of a property is accessed via ${} -->
  <property name="src.dir" location="src" />
  <property name="lib.dir" location="WebContent/WEB-INF/lib" />
  <property name="server.common.lib.dir" location="/home/ghali/jboss-5.1.0.GA/common/lib" />
  <property name="server.lib.dir" location="/home/ghali/jboss-5.1.0.GA/lib" />
  <property name="build.dir" location="build" />
  <property name="dist.dir" location="dist" />
  <property name="docs.dir" location="docs" />
  <!--
    Create a classpath container which can be later used in the ant task
  -->
  <path id="build.classpath">
    <fileset dir="${lib.dir}">
      <include name="**/*.jar" />
    </fileset>
    <fileset dir="${server.common.lib.dir}">
      <include name="**/*.jar" />
    </fileset>
    <fileset dir="${server.lib.dir}">
      <include name="**/*.jar" />
    </fileset>
  </path>

  <!-- Deletes the existing build, docs and dist directory-->
  <target name="clean">
    <delete dir="${build.dir}" />
    <delete dir="${docs.dir}" />
    <delete dir="${dist.dir}" />
  </target>

  <!-- Creates the  build, docs and dist directory-->
  <target name="makedir">
    <mkdir dir="${build.dir}" />
    <mkdir dir="${docs.dir}" />
    <mkdir dir="${dist.dir}" />
  </target>

  <!-- Compiles the java code -->
  <target name="compile" depends="clean, makedir">
    <javac destdir="${build.dir}" classpathref="build.classpath" debug="true">
      <src path="${src.dir}" />
    </javac>
  </target>

<!-- Creates Javadoc -->
  <target name="docs" depends="compile">
    <javadoc sourcepath="${src.dir}" destdir="${docs.dir}">
      <!-- Define which files / directory should get included, we include all -->
       <fileset dir="${src.dir}">
                <include name="**" />
           </fileset>
    </javadoc>
  </target>

  <!--Creates the deployable jar file  -->
  <target name="package" depends="compile">
    <war destfile="${dist.dir}/project1.war" webxml="WebContent/WEB-INF/web.xml">
      <fileset dir="WebContent" />
      <lib dir="WebContent/WEB-INF/lib" />
      <classes dir="${build.dir}" />
    </war>
  </target>

  <target name="main" depends="compile, package, docs">
    <description>Main target</description>
  </target>

</project>

0 个答案:

没有答案