Maven 2 & 3

Support property ${baseurl} to get RFC-compliant URL of project base directory

Details

  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

If people currently need a URL to their project base directory or any file within, they need to write {{file://$\{basedir}}/}}. The problem about this approach is that it doesn't deliver a RFC-compliant URL since characters are not properly percent-encoded. Also, the exact number of slashes between file: and {{${basedir}}} depends on the OS (e.g. file:///C:/user/ and file:///home/user, Unix paths have a leading slash by themselves, Windows not). This makes it currently impossible to configure plugins that expect a URL as input and do strict URL parsing.

For this reason, I suggest to support an additional property {{${baseurl}}} with the value

baseurl = new File( basedir ).toURI().toString()

for POM interpolation.

Some day, when Maven/Wagon itself handle percent-encoded file: URLs correctly (WAGON-111), this property could also be used to define local deployment repos like we commonly use for testing.

Issue Links

Activity

Hide
Brett Porter added a comment -

implemented, leaving open until I add docs

Show
Brett Porter added a comment - implemented, leaving open until I add docs
Hide
Brett Porter added a comment -

docs added

Show
Brett Porter added a comment - docs added
Hide
Benjamin Bentmann added a comment -

Merged to 3.x in r752241.

Show
Benjamin Bentmann added a comment - Merged to 3.x in r752241.
Hide
Lars Beuster added a comment -

Maven 2.1.0: The new property (the final name seems to be ${project.baseUri}) works in the POM but isn't replaced with it's current value during resource filtering.

Show
Lars Beuster added a comment - Maven 2.1.0: The new property (the final name seems to be ${project.baseUri}) works in the POM but isn't replaced with it's current value during resource filtering.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: