aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant cannot find file, but it's there Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant cannot find file, but it Watch "Ant cannot find file, but it New topic
Author

Ant cannot find file, but it's there

James Adams
Ranch Hand

Joined: Sep 12, 2003
Posts: 188
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

Joined: Nov 14, 2000
Posts: 1953
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

Joined: Jul 11, 2001
Posts: 14112
Or run Ant with -verbose, or even -debug, to get more information on what it is doing, and where.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant cannot find file, but it's there