build.xml不编译我的Web项目

时间:2013-02-02 13:19:49

标签: ant build.xml

我尝试使用ant为我的web项目启动编译,这是架构:

YAAP:根目录包含

|-->build.xml
|-->src
    |-->Main.java
    |-->ma
        |-->gon
            |-->yaap
                |-->exception
                    |--> *.java
                |-->listeners
                    |--> *.java
                |-->servlets
                    |--> *.java
                |-->utils
                    |--> *.java
    |-->ressources
        |-->params.properties
|-->WebContent

这是我编译项目的初始build.xml

<property name="src.dir" value="src"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>


<target name="init" >
    <mkdir dir="${build.dir}"/>
</target>

<target name="dependencyCheck">
    <available  type="dir" file="lib" property="hasDependency"/>
</target>


<target name="compileDep" depends="dependencyCheck, init" if="hasDependency" >
    <javac srcdir="${src.dir}" destdir="${build.dir}" >
        <classpath>
            <fileset dir="${lib.dir}" id="jars">
                <include name="*.jar"/>
            </fileset>
        </classpath>
    </javac>
</target>

<target name="compile" depends="dependencyCheck, init" unless="hasDependency" >
        <javac srcdir="${src.dir}" destdir="${build.dir}" >
        </javac>
</target>

<target name="finish" depends="init, dependencyCheck, compile, compileDep"></target>

但是这会导致错误找不到符号并且不知道servlet类。请问你能修正build.xml吗? 谢谢。

命令只是:ant


错误

compileDep:
    [javac] Compiling 12 source files to C:\jenkinsWar\jenkinsHome\workspace\PremierTest\YAAP\build
    [javac] C:\jenkinsWar\jenkinsHome\workspace\PremierTest\YAAP\src\Main.java:10: error: cannot find symbol
    [javac] import ma.gon.yaap.utils.PackageUtilss;
    [javac]                         ^
    [javac]   symbol:   class PackageUtilss
    [javac]   location: package ma.gon.yaap.utils
    [javac] C:\jenkinsWar\jenkinsHome\workspace\PremierTest\YAAP\src\ma\gon\yaap\listeners\ApplicationListener.java:7: error: package javax.servlet does not exist
    [javac] import javax.servlet.ServletContextEvent;
    [javac]                     ^
    [javac] C:\jenkinsWar\jenkinsHome\workspace\PremierTest\YAAP\src\ma\gon\yaap\listeners\ApplicationListener.java:8: error: package javax.servlet does not exist
    [javac] import javax.servlet.ServletContextListener;
    [javac]                     ^
    [javac]
 ...

0 个答案:

没有答案