Hi,
Turns out that this is due to spaces in the path to the m2 repository.
buildr/java/jruby.rb uses the deprecated java.io.File.toURL which does
not escape illegal URL characters. Creating an URL via the toURI
method as recommended in the sun javadocs works fine:
Index: lib/buildr/java/jruby.rb
===================================================================
--- lib/buildr/java/jruby.rb (revision 645711)
+++ lib/buildr/java/jruby.rb (arbetskopia)
@@ -81,7 +81,7 @@
add_url_method = java.lang.Class.forName('java.net.URLClassLoader').
getDeclaredMethod('addURL', [java.net.URL].to_java(java.lang.Class))
add_url_method.setAccessible(true)
- add_path = lambda { |path| add_url_method.invoke(sysloader,
[java.io.File.new(path).toURL].to_java(java.net.URL)) }
+ add_path = lambda { |path| add_url_method.invoke(sysloader,
[java.io.File.new(path).toURI.toURL].to_java(java.net.URL)) }
# Include tools (compiler, Javadoc, etc) for all platforms except OS/X.
unless Config::CONFIG['host_os'] =~ /darwin/i
home = ENV['JAVA_HOME'] or fail 'Are we forgetting something?
JAVA_HOME not set.'
/tomas
On Mon, Apr 7, 2008 at 9:39 PM, Victor Hugo Borja <[EMAIL PROTECTED]> wrote:
>
> Tomas Carlsson wrote:
>
> > buildr-trunk, JRuby 1.1, Windows XP
> >
> > I set up a very simple test project with one java class and one test java
> > class with Junit annotations. Running "jruby -S buildr test" fails with:
> > java.lang.IllegalArgumentException: null
> >
> > Parts of --trace is included below, it indicates a null ref when looking
> up
> > the ant.jar location if I'm not mistaken.
> >
> > Anyone seen this before? Anyone been able to run JUnit tests with buildr
> on
> > JRuby?
> >
> > /tomas
> >
> > ** Invoke buildr-test-test:test:setup (first_time)
> > ** Execute buildr-test-test:test:setup
> > ** Execute buildr-test-test:test
> > Running tests in buildr-test-test
> > redefining Project
> > D, [2008-04-07T17:43:57.413434 #3380] DEBUG -- : Apache Ant version 1.7.0
> > compiled on December 13 2006
> > ** Invoke buildr-test-test:test:teardown (first_time)
> > ** Execute buildr-test-test:test:teardown
> > rake aborted!
> > java.lang.IllegalArgumentException: null
> > java/net/URI.java:842:in `create'
> > sun/reflect/NativeMethodAccessorImpl.java:-2:in `invoke0'
> > sun/reflect/NativeMethodAccessorImpl.java:39:in `invoke'
> > sun/reflect/DelegatingMethodAccessorImpl.java:25:in `invoke'
> > java/lang/reflect/Method.java:597:in `invoke'
> > org/apache/tools/ant/launch/Locator.java:162:in `fromURI'
> > org/apache/tools/ant/launch/Locator.java:119:in `getResourceSource'
> > org/apache/tools/ant/launch/Locator.java:90:in `getClassSource'
> > org/apache/tools/ant/Project.java:313:in `setAntLib'
> > org/apache/tools/ant/Project.java:309:in `initProperties'
> > org/apache/tools/ant/Project.java:295:in `init'
> > sun/reflect/NativeMethodAccessorImpl.java:-2:in `invoke0'
> > sun/reflect/NativeMethodAccessorImpl.java:39:in `invoke'
> > sun/reflect/DelegatingMethodAccessorImpl.java:25:in `invoke'
> > java/lang/reflect/Method.java:597:in `invoke'
> > org/jruby/javasupport/JavaMethod.java:251:in `invokeWithExceptionHandling'
> >
> >
>
> That seems to be a classpath issue on windows (never seen this on my linux
> env). I tested with a simple ant invocation:
>
> task :echo do
> ant('echo') do |ant|
> ant.echo :message => "Hello World"
> end
> end
>
> got the same error you have, however if ant jars are in the CLASSPATH
> environment variable when invoking jruby everyting works ok. So I think
> this is related to how the classpath is updated by buildr/java/jruby.rb,
> I'll try to check this as soon as I can.
>
> Greetings!
> --
> vic
>
>
>