maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laird Nelson <ljnel...@gmail.com>
Subject During plugin development, what is the context classloader set to?
Date Wed, 08 Jan 2014 18:50:41 GMT
I have a plugin that I'm writing that needs to do two things during the
course of its execution:
Load a resource from the current project's classpath
Load a resource from its own guts

This is a fallback kind of thing: if the plugin can't find anything
appropriate on the project classpath, then and only then do I want it to
examine its own .jar file for the resource in question.

My hunch is that there are probably already two classloaders set up for
just this purpose.

I am guessing (haven't tried yet) that the project classpath is probably
visible to Thread.currentThread().getContextClassLoader().  Is that right?

I'm also guessing (haven't tried yet) that from within my mojo
this.getClass().getClassLoader() will return me a ClassLoader that is set
up to be able to see my mojo's innards.  Is that right?

Best,
Laird

-- 
http://about.me/lairdnelson

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message