On Mon, 2003-06-23 at 23:31, Brett Porter wrote:
> Mark H. Wilkinson wrote:
> > On Mon, 2003-06-23 at 14:42, Brett Porter wrote:
> > 
> >>There are two alternatives:
> >>1) assume all of these paths are relative to project.xml.
> > 
> > I'd vote for this one unless someone can explain...
> 
> If you vote for this one, do you also allow ${basedir}?

Hrrm; good question. Given a clean slate I'd remove it, but I suspect
that would break a significant number of projects already out there. The
right thing to do is probably to allow relative or absolute paths (after
interpolation), and prefix ${basedir} to all relative paths. The
documentation should then explain that prefixing with ${basedir} is
redundant and other absolute paths are a bad idea (because they are
generally not portable between machines and operating systems).

Perhaps prefixing with ${basedir} could be deprecated over time?

> >>2) require all to be absolute paths (using basedir where needed to know
> >>where project.xml lives).
> > 
> > ... under what circumstances project.xml should contain an absolute path
> > that doesn't start with ${basedir}.
> 
> I can't think of any to be honest. I was thinking of letting Maven 
> silently convert relative paths to absolute ones by adding basedir to 
> the front, but I'm worried about the inconsistency of allowing basedir 
> and not.

I don't see an inconsistency, but I might be misinterpreting this last
sentence. It seems to make sense to me that relative paths in a
configuration file should be relative to the directory containing the
configuration file, absolute ones should be taken as is. The logic
doesn't seem difficult:

public File absolute(String basedir, String path) {
    File f = new File(path);
    if (!f.isAbsolute)
        f = new File(basedir, path);
    return f;
}

Oddly enough, the only call to File.isAbsolute in the maven source tree
is in the jxr plugin, where it does exactly this, with the comment:

<!-- XXX This is a dirty hack until the semantics of
pom.build.sourceDirectory are cleared up -->

:-)

> Also, when we get to jelly scripts like maven.xml, it gets harder (if 
> possible?) to preprocess relative paths, so ${basedir} is then required. 
>   However, this is likely to generate less complaints on the user list 
> as fewer people do any jelly scripting for their builds :)

Yeah, true. It's probably not possible to reliably identify relative
paths in maven.xml scripts. Not without making all the jelly tags aware
of basedir, anyway. That inconsistency is a bit of a pain. People are
going to have working maven.xml files that suddenly break when they run
them with a different working directory.

-Mark.


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

Reply via email to