Am I the only one who misses ant's '-find' command line option?  I realize I
can use maven's '-d' option to specify the working directory, but this makes
switching between projects/platforms pretty awkward.  I'd rather just have
it use the first maven.xml (project.xml?) it finds searching up the
directory tree.

It would be easy enough to add a find option, but because maven uses two
config files (maven.xml and project.xml) instead of ant's one (build.xml),
I'm not sure which one it should find.

I was thinking maybe the App.initializeCore method could do something like
this:

if (getCli().hasOption("f"))
{
    File file = find (getCli().getOptionValue("f"));
    getMaven().setProjectBuildFile (file);
    getMaven().setDir (file.getParent());
}
....
File find (String filename) throws FileNotFoundException
{
    // An empty string should resolve to the current directory (user.dir)
    return find (new File (""), filename);
}

File find (File start, String suffix) throws FileNotFoundException
{
    if (start == null) {
        throw new FileNotFoundException();
    }
    File dir = start.getAbsoluteFile();
    File file = new File(dir, suffix);
    return file.exists() ? file : find (dir.getParentFile(), suffix);
}

Jim


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to