> Alexander Horn wrote:
> However, what do I need to do to determine the local file
> system location of an artifact from outside a Mojo (i.e. a
Just IMO, it would be better if your TestCase's had no knowledge of
Maven
or the execution environment they're running in.
Personally, I would locate the URL using the classloader's getResource()
method.
(Of course, you need to know a class or marker file to search for.)
Not sure if this good enough for your scenario?
An example:
To get the location of junit's jar I would look for
junit.framework.TestCase.class
import java.net.URL;
import junit.framework.TestCase;
public class ResourceUrlTest extends TestCase {
public ResourceUrlTest(String name) {
super(name);
}
public void resourceLocationTest() {
URL loc =
Thread.currentThread().getContextClassLoader().getResource("junit/framew
ork/TestCase.class");
fail(loc.toExternalForm());
}
}
Outputs the following in the Surefire log:
junit.framework.AssertionFailedError:
jar:file:/C:/Documents%20and%20Settings/treilly/.m2/repository/junit/jun
it/3.8.1/junit-3.8.1.jar!/junit/framework/TestCase.class
Curious, why would a junit test act upon or need information about
another artifact?
(I think this is probably a topic for the user list, any dev's feel free
to correct me.)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]