I am looking for a solution to that too. My workaround was until now to
pick specific classes whose JAR files I needed and do
_class.getResource(/ + _class.getCanonicalName().replace(., /) +
.class).toString().replaceAll(-client.jar!,
.jar!).replaceFirst(jar:file:([^!]+).*, $1)
and append
Thanks Stefan, nice hack ;-) I didn't know that you can get the Jar
file via the class resource URL, but it makes sense.
FYI, I made a useful method out of this (I removed the special -
client.jar replacement):
/**
* Returns the path to the JAR file that a certain class is located
in.
Yes, that client was just because from within an Maven execution the
classpath would give me the -client.jar first, but I needed the jar
without client.
Stefan
Alexander Klimetschek wrote:
Thanks Stefan, nice hack ;-) I didn't know that you can get the Jar file
via the class resource URL,
Hi all,
I have a test case which starts another JVM (a derby database server
in network mode). The classpath for the new JVM needs jar files which
are defined as test dependencies (derby is available in the form of
maven artifacts, and I want to test it against the same derby version
I forgot to mention that the unit test runs perfect in Eclipse,
because the project created by mvn eclipse:eclipse includes all test
dependencies as well and the Eclipse jUnit runner puts all of them in
the class path for the test. Would be cool to have the Eclipse project
and mvn test