Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant cannot find file, but it's there

 
James Adams
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am executing an Ant target which worked well a few days ago, and now it complains that a file isn't found. I can see the file in the directory tree so I know it's there. Other Ant targets in the same build.xml are working fine. I'm not sure if this is a problem with Ant or with the task being run as part of the target (Hibernate's SchemaExportTask). In any event I'm prety stumped, so I hope someone can give me some ideas to try out to get over this hump.

I have the following target in my build.xml:

<target name="schema"
depends="prepare"
description="Generate database schemas from the O/R mapping files">

<!-- Teach Ant how to use Hibernate's schema generation tool -->
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="project.class.path"/>

<!-- Run the schema export task -->
<schemaexport config="${class.root}/hibernate.cfg.xml"
quiet="no"
text="no"
drop="no">
<!-- Make sure we don't overwrite the FIRMS or TRADERS schemas -->
<fileset dir="${class.root}">
<exclude name="**/Firm.hbm.xml"/>
<exclude name="**/Trader.hbm.xml"/>
</fileset>
</schemaexport>
</target>


When I run it (within Eclipse) I get the following output:


BUILD FAILED
C:\cvshomedir\hibernate\build.xml:109: Schema text failed: could not find file: target\classes\hibernate.cfg.xml


The operative variables are as such:
basedir == . (i.e. C:\cvshomedir\hibernate)
class.root == target/classes

The file is present as C:\cvshomedir\hibernate\target\classes\hibernate.cfg.xml


The only thing I can think of is that I have updated my Eclipse to version 3.1M6 since I last ran this target -- I don't really think that that would have anything to do with this, but I mention it just in case.

Any suggestions or insight will be greatly appreciated!


--James
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do an echo on where you have doubt. You will find out what is the problem easily. Just like the old c printf() or Java System.println()
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or run Ant with -verbose, or even -debug, to get more information on what it is doing, and where.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic