MalformedURLException on windows when useSystemClassLoader set to true
----------------------------------------------------------------------

                 Key: SUREFIRE-322
                 URL: http://jira.codehaus.org/browse/SUREFIRE-322
             Project: Maven Surefire
          Issue Type: Bug
          Components: plugin
    Affects Versions: 2.3
         Environment: Windows XP (and probably all win32 OS)
            Reporter: Mark Palmer


useSystemClassLoader does not work on windows XP, due to the way that the 
surefire plugin creates a manifest.mf which includes all necessary jars to run 
the projects tests.

The manifest.mf file created in surefirebooter[1-9]*.jar contains absolute 
paths that begin with the drive letter, e.g. c:\somedir\somejar.jar on
on unix this would be /somedir/somejar.jar which java.net.URL can cope with, on 
windows c:/somedir/somejar.jar needs to be changed to 
file:///c:\somedir\somejar.jar

steps to recreate are simple:

1. mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app
2. add the following entry in pom.xml for my-app

        <build>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-plugin</artifactId>
                                <configuration>
                                        
<useSystemClassLoader>true</useSystemClassLoader>
                                </configuration>
                        </plugin>
                </plugins>
        </build>

3. mvn install

which will fail with 

[INFO] Building jar: c:\DOCUME~1\username\LOCALS~1\Temp\surefirebooter43635.jar
java.net.MalformedURLException: unknown protocol: c
        at java.net.URL.<init>(URL.java:573)
        at java.net.URL.<init>(URL.java:463)
        at sun.misc.URLClassPath$JarLoader.parseClassPath(URLClassPath.java:923)
        at sun.misc.URLClassPath$JarLoader.getClassPath(URLClassPath.java:896)
        at sun.misc.URLClassPath.getLoader(URLClassPath.java:351)
        at sun.misc.URLClassPath.getResource(URLClassPath.java:205)
        at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:846)
        at java.security.AccessController.doPrivileged1(Native Method)
        at 
java.security.AccessController.doPrivileged(AccessController.java:389)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:371)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:570)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:442)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:502)
The java class is not found:  org/apache/maven/surefire/booter/SurefireBooter




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to