On Tue, 2003-06-24 at 23:28, Brett Porter wrote:
> > 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
> 
> I was really concerned with the inconsistency between project.xml and 
> maven.xml

Ah; yeah, that's a bit of a bummer.

> > Oddly enough, the only call to File.isAbsolute in the maven source tree
> > is in the jxr plugin [...]
> 
> That does seem odd :) But its right - the plugin shouldn't have to care, 
> it should just get a File that works. Because Java doesn't want to 
> chdir, setting all File objects to absolute by prepending ${basedir} 
> makes sense (and ${basedir} should probably be put through a 
> getAbsoluteFile() too).

Agreed - ${pom.build.sourceDirectory} should always return an absolute
path, because most of the time that's what a plugin will want.

There are occasions when a plugin will want a value for a path relative
to ${basedir} - the Eclipse plugin needs to do this because paths in the
Eclipse .classpath file need to be relative as well, and it might be
useful for diagnostic messages too. Jelly doesn't make it easy to do
this, so it would be useful to have some way to perform this conversion.
I'm thinking this could either be a sister-method that returns exactly
what was in project.xml (${pom.build.verbatimSourceDirectory} perhaps),
or a generic helper method to make a project-relative path:
${pom.getProjectRelativePath(srcDir)}
I don't think the verbatimSourceDirectory option is a good one though:
unless we're ensuring the project.xml *only* contains relative paths,
verbatimSourceDirectory might still be an absolute path. The helper
method (or something like it) seems like a better option to me.

> One alternative, but its a bit dodgy, is to make sure all relative paths 
> are done using File objects, and there is no other supposition of CWD, 
> because then you can redefine the system property user.dir and File's 
> start moving as though that is the base if you call getAbsolutePath - 
> but I see this to be quite error prone :)

Ick! For reactor builds you'd need to set user.dir every time you run
code that's working on behalf of a different project, just in case it
creates a new calls getAbsolutePath on a File object. That sounds
tricky!

-Mark.


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

Reply via email to