ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominique Devienne" <DDevie...@lgc.com>
Subject Unhelpful message with combining <import> and <subant>
Date Fri, 20 Aug 2004 15:45:39 GMT
I'm using Ant to build large C/C++/Java applications composed of many
libraries, binaries, and JARs. I factor out my common things in a few
build files in a config directory, and use one build file per
library/binary/jar that imports a common build file. This works great,
and <import> and <subant> are invaluable new Ant 1.6 tools to design
such large builds.

To get to each of the library/binary/jar build file, I have a very
simple and generic recurse.xml (shown below) build file that one
imports, just defining the buildpath to recurse into. In a typical
layout, the top-level build.xml (which imports recurse.xml) delegates to
src/lib/build.xml and src/bin/build.xml, and src/java/build.xml. These
build files then in turn delegate to their own sub-builds
(src/lib/build.xml recurses into dbtools/build.xml and utils/build.xml).
The find command below shows the test layout I setup for demoing my pb.

Before showing my pb, I've output a successful traversal of all the
build files. Then I edited src/java/build.xml to reference a directory
that does not exist in the build path: the build failed, as expected,
but where I'm getting at is that the failure stack trace just shows the
error from originating from recurse.xml with no mention of which build
files imported recurse.xml. The error message is explicit enough though
to find out what's wrong, and where.

I then added the missing directory, but not the build.xml file. The
failed again of course, and the error message is still helpful enough to
figure it out.

But now I touched the missing build.xml, which is thus empty, and this
time the error message is not helpful, and it's really hard to figure
out where the problem lies. Here is the error message and trace from the
bottom of this email:

BUILD FAILED
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   The following error occurred while executing this line:
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   The following error occurred while executing this line: Premature end
of file.

So basically what I requesting is that Ant outputs an error like this:

BUILD FAILED
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   The following error occurred while executing this line:
imported from C:\oss\org_apache\antx\recurse\build.xml:5
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   The following error occurred while executing this line: Premature end
of file.
imported from C:\oss\org_apache\antx\recurse\src\lib\build.xml:5

So that troubleshooting the issue becomes much easier.

If additionally the Premature end of file could mention which file
prematurely ended, that would be even better ;-)

Thanks, --DD

PS: FWIW, someone added a file in ClearCase, and checked in the
directory
    containing the file without checking in the file itself, resulting
in
    the empty build file. So this is a real world failure ;-)


C:\oss\org_apache\antx\recurse>dir /S /B
C:\oss\org_apache\antx\recurse\build.xml
C:\oss\org_apache\antx\recurse\config
C:\oss\org_apache\antx\recurse\src
C:\oss\org_apache\antx\recurse\config\common.xml
C:\oss\org_apache\antx\recurse\config\recurse.xml
C:\oss\org_apache\antx\recurse\src\bin
C:\oss\org_apache\antx\recurse\src\java
C:\oss\org_apache\antx\recurse\src\lib
C:\oss\org_apache\antx\recurse\src\bin\build.xml
C:\oss\org_apache\antx\recurse\src\bin\dbserver
C:\oss\org_apache\antx\recurse\src\bin\plot
C:\oss\org_apache\antx\recurse\src\bin\dbserver\build.xml
C:\oss\org_apache\antx\recurse\src\bin\plot\build.xml
C:\oss\org_apache\antx\recurse\src\java\build.xml
C:\oss\org_apache\antx\recurse\src\java\jdbserver
C:\oss\org_apache\antx\recurse\src\java\missing
C:\oss\org_apache\antx\recurse\src\java\jdbserver\build.xml
C:\oss\org_apache\antx\recurse\src\java\missing\build.xml
C:\oss\org_apache\antx\recurse\src\lib\build.xml
C:\oss\org_apache\antx\recurse\src\lib\dbtools
C:\oss\org_apache\antx\recurse\src\lib\utils
C:\oss\org_apache\antx\recurse\src\lib\dbtools\build.xml
C:\oss\org_apache\antx\recurse\src\lib\utils\build.xml

C:\oss\org_apache\antx\recurse>type src\java\build.xml
<?xml version="1.0"?>

<project name="src/java" default="build">

  <import file="../../config/recurse.xml" />

  <path id="buildpath">
    <pathelement location="jdbserver" />
    <pathelement location="missing" />
  </path>

</project>

C:\oss\org_apache\antx\recurse>type config\recurse.xml
<?xml version="1.0"?>

<project name="recurse">

  <target name="clean">
    <subant buildpathref="buildpath" target="clean" />
  </target>

  <target name="build">
    <subant buildpathref="buildpath" target="build" />
  </target>

  <target name="trace">
    <echo>Recursing from ${ant.project.name}: ${ant.file}</echo>
    <subant buildpathref="buildpath" target="trace" />
  </target>

</project>

C:\oss\org_apache\antx\recurse>
C:\oss\org_apache\antx\recurse>dir src\java\missing
 Volume in drive C has no label.
 Volume Serial Number is 6051-15B3

 Directory of C:\oss\org_apache\antx\recurse\src\java\missing

08/20/2004  10:14a      <DIR>          .
08/20/2004  10:14a      <DIR>          ..
08/20/2004  10:14a                   0 build.xml
               1 File(s)              0 bytes
               2 Dir(s)   2,265,778,688 bytes free

C:\oss\org_apache\antx\recurse>

C:\oss\org_apache\antx\recurse>C:\pro\ant\1.6.2\bin\ant trace
Buildfile: build.xml

trace:
     [echo] Recursing from recurse-demo:
C:\oss\org_apache\antx\recurse\build.xml

trace:
     [echo] Recursing from src/lib:
C:\oss\org_apache\antx\recurse\src\lib\build.xml

trace:
     [echo] Recursed into utils:
C:\oss\org_apache\antx\recurse\src\lib\utils\build.xml

trace:
     [echo] Recursed into dbtools:
C:\oss\org_apache\antx\recurse\src\lib\dbtools\build.xml

trace:
     [echo] Recursing from src/bin:
C:\oss\org_apache\antx\recurse\src\bin\build.xml

trace:
     [echo] Recursed into dbserver:
C:\oss\org_apache\antx\recurse\src\bin\dbserver\build.xml

trace:
     [echo] Recursed into plot:
C:\oss\org_apache\antx\recurse\src\bin\plot\build.xml

trace:
     [echo] Recursing from src/java:
C:\oss\org_apache\antx\recurse\src\java\build.xml

trace:
     [echo] Recursed into jdbserver:
C:\oss\org_apache\antx\recurse\src\java\jdbserver\build.xml

BUILD SUCCESSFUL
Total time: 1 second
C:\oss\org_apache\antx\recurse>
C:\oss\org_apache\antx\recurse>C:\pro\ant\1.6.2\bin\ant trace
Buildfile: build.xml
...
trace:
     [echo] Recursing from src/java:
C:\oss\org_apache\antx\recurse\src\java\build.xml

trace:
     [echo] Recursed into jdbserver:
C:\oss\org_apache\antx\recurse\src\java\jdbserver\build.xml

BUILD FAILED
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   The following error occurred while executing this line:
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   Invalid file: C:\oss\org_apache\antx\recurse\src\java\missing

Total time: 1 second
C:\oss\org_apache\antx\recurse>md src\java\missing
C:\oss\org_apache\antx\recurse>C:\pro\ant\1.6.2\bin\ant trace
Buildfile: build.xml
...
trace:
     [echo] Recursing from src/java:
C:\oss\org_apache\antx\recurse\src\java\build.xml

trace:
     [echo] Recursed into jdbserver:
C:\oss\org_apache\antx\recurse\src\java\jdbserver\build.xml

BUILD FAILED
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   The following error occurred while executing this line:
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   Invalid file:
C:\oss\org_apache\antx\recurse\src\java\missing\build.xml

Total time: 1 second
C:\oss\org_apache\antx\recurse>touch src\java\missing\build.xml
C:\oss\org_apache\antx\recurse>C:\pro\ant\1.6.2\bin\ant trace
Buildfile: build.xml
...
trace:
     [echo] Recursing from src/java:
C:\oss\org_apache\antx\recurse\src\java\build.xml

trace:
     [echo] Recursed into jdbserver:
C:\oss\org_apache\antx\recurse\src\java\jdbserver\build.xml

BUILD FAILED
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   The following error occurred while executing this line:
C:\oss\org_apache\antx\recurse\config\recurse.xml:15:
   The following error occurred while executing this line: Premature end
of file.

Total time: 1 second
C:\oss\org_apache\antx\recurse>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message