Hi,
OK this stems from discussion on the user@ list a while ago [1] and my
discovery of NUTCH-672 yesterday. I attached a patch, which fails
completely, as I hadn't uncovered things I now know.
The original patch submitted for the issue would have been fine for <=Nutch
1.2 but now as the file structure has changed in >= Nutch 1.3 both pre and
post build with ant it is no longer as trivial as it looks. Basically the
additions to the bin/nutch script would something similar to this
echo " plugin load a plugin and run one of its classes main()"
echo " junit runs the given JUnit test"
echo " or"
echo " CLASSNAME run the class named CLASSNAME"
--------------------------------------------------------------
elif [ "$COMMAND" = "plugin" ] ; then
CLASS=org.apache.nutch.plugin.PluginRepository
elif [ "$COMMAND" = "junit" ] ; then
CLASSPATH=$CLASSPATH:src/test/
CLASS='junit.textui.TestRunner'
else
CLASS=$COMMAND
This would enable us to execute for example bin/nutch junit
org.apache.nutch.crawl.CrawlDBTestUtil, However the problem we face is that
we now no longer have /lib existing under /branch-1.4, it is instead located
under /branch-1.4/runtime/local/lib or alternatively in the /lib directory
in snapshop.job in deploy mode.
I'm therefore getting the class not found error if I try to run.
Exception in thread "main" java.lang.NoClassDefFoundError:
junit/textui/TestRunner
Caused by: java.lang.ClassNotFoundException: junit.textui.TestRunner
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: junit.textui.TestRunner. Program will exit.
One observation I have, regardless of whether we would wish to run junit
tests on test classes in a either a development or production environment
e.g. from source or from post build runtime code the correct command line
options would have to be specified within the source nutch script.
I've been looking at this for a while and haven't really made much progress
apart form the above observations. Can anyone shine some light or even
suggest how we could correctly configure a patch for the Nutch script?
Thank you
[1] http://www.mail-archive.com/[email protected]/msg03207.html
--
*Lewis*