[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A newbie to ant\question?



Buildfile: build.xml

clean:
   [delete] Deleting directory C:\Java\Work\doc
   [delete] Deleting directory C:\Java\Work\release
   [delete] Deleting directory C:\Java\Work\classes

prepare:
    [mkdir] Created dir: C:\Java\Work\release
    [mkdir] Created dir: C:\Java\Work\classes
    [mkdir] Created dir: C:\Java\Work\doc

compile:
    [javac] Compiling 2 source files to C:\Java\Work\classes
    [javac] C:\Java\Work\src\Hello.java:3: duplicate class: Test.Hello
    [javac] public class Hello
    [javac]        ^
    [javac] C:\Java\Work\src\HelloWorld.java:15: cannot resolve symbol
    [javac] symbol  : constructor Hello  ()
    [javac] location: class Hello
    [javac]     Hello h = new Hello();
    [javac]               ^
    [javac] 2 errors
    [javac] Compile failed, messages should have been provided.

The above is a listing of an log file documenting my struggle compiling my
project using ant.

The project consist of two files. The first file declares class Hello which
contained in a package named Test. The second file is a driver program named
HelloWorld that uses the packaged class Hello.

I an using a standard build.xml with no advanced gimmicks. The following is
listing of the compile target.

<target name="compile" depends="prepare">
<!-- Compile the java code from ${src} into ${build} -->
<javac
  srcdir="${src}"
  destdir="${classes}"
  target ="1.3"
  failonerror="no"
  classpath="${lib_path}"
/>
</target>


I can compile the packaged class by itself and the appropiate Test directory
is created. When I try to compile with the both files, the above errors
occurrs.

Any suggestions would be greatly apprepiated? Thanks in advance!