Closed DavidWhitlock closed 10 years ago
Good news! I tried cloning my git repository (https://github.com/DavidWhitlock/PortlandStateJavaSummer2014) and I saw the same thing. Now I can debug it.
Here's what I get from the debugging I added last night.
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalStateException: Could not find any files in /u/whitlock/git/PortlandStateJavaSummer2014/koans/app/lib
at com.sandwich.koan.KoanClassLoader.buildClassPath(KoanClassLoader.java:59)
at com.sandwich.koan.KoanClassLoader.<init>(KoanClassLoader.java:20)
at com.sandwich.koan.KoanClassLoader.getInstance(KoanClassLoader.java:72)
at com.sandwich.koan.runner.RunKoans.runKoans(RunKoans.java:54)
at com.sandwich.koan.runner.RunKoans.run(RunKoans.java:46)
at com.sandwich.koan.constant.ArgumentType.run(ArgumentType.java:76)
at com.sandwich.koan.cmdline.CommandLineArgument.run(CommandLineArgument.java:38)
at com.sandwich.koan.cmdline.CommandLineArgumentRunner.run(CommandLineArgumentRunner.java:26)
at com.sandwich.koan.runner.AppLauncher.main(AppLauncher.java:47)
... 6 more
And that makes sense because that directory contains jar files. And jar files are ignored by git. Derft.
I was able to work around this problem by simply adding the jar files to git:
$ git add --force app/lib*.jar
$ git commit -m "Forcibly add jar files to work around https://github.com/DavidWhitlock/java-koans/issues/7"
But I want to look into this a little more. What, exactly, are in those jar files? Are they the stuff in the koans-lib
?
Yes, it looks like the classes in the four jar files in the app/lib
directory are the one in the koans-lib
artifact. Maybe I just need to change the KoanClassLoader
to tolerate no classes being available in that directory (assuming that koans-lib is on the class path).
I've been working with the koans and I don't think tolerating an empty "app/lib" directory will work. There are at least two places in the koan-lib code that expect that directory to be populated. I think it would be better to have the Maven build copy the koan-lib artifact into the app/lib directory.
Maybe something like this:
Or I could just refactor the code for creating the classpath into one place. I should just look for usages of DirectoryManager.getProjectLibraryDir()
and go from there.
I think I finally have this problem sorted out.
A couple of students have reported seeing this exception when they copy their koans project to a second machine using git.
https://plus.google.com/u/0/102032333290286425390/posts/gLxHo7vsnwj