Maven 2.x Exec Plugin

Use File.toURI().toURL() when adding dependencies to the classpath.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.1.1
  • Fix Version/s: 1.2
  • Component/s: java
  • Labels:
    None
  • Patch Submitted:
    Yes
  • Number of attachments :
    1

Description

exec:java adds project dependencies to the classpath using the File.toURL() method. According to the documentation at http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#toURL(), this method won't escape illegal characters in URLs, such as spaces. This means that if the dependency is within c:\Documents and Settings\.m2\repository..., it will be appended as-is to the classpath.

This does not work when using the Jetty servlet container. When deploying a web application it will try to iterate over all the URLs on the classpath and call .toURI() on them (see http://download.eclipse.org/jetty/7.0.1.v20091125/xref/org/eclipse/jetty/webapp/WebInfConfiguration.html#81). This fails because the URLs contain spaces.

I'm not sure if this is Jetty's or MEXEC's fault, but calling File.toURI().toURL() instead of just File.toURL() when adding the URL to the classpath solves the problem. The attached patch does just that.

Activity

Hide
Robert Scholte added a comment -

Fixed in rev. 12385

Show
Robert Scholte added a comment - Fixed in rev. 12385

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: