So I figured this out by looking at the pmd report plugin, but essentially
you need to use a different classloader. so you will need to do something
like this:
ClassLoader origLoader =
Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
//run report
}
finally {
Thread.currentThread().setContextClassLoader(origLoader);
}
don't forget to switch the classloader back.
-zach
Zach Legein wrote:
>
> I am trying to run a maven report that I wrote that needs to create a
> spring applicationcontext. but I seem to have a problem placing the spring
> context files needed on the classpath for the site report to run properly.
>
> I have this a report setting setup in my pom.xml :
>
> <reporting>
> <plugins>
> <plugin>
> <groupId>myreport</groupId>
> <artifactId>plugin</artifactId>
> <version>1-SNAPSHOT</version>
> <configuration>
> <xmlreport>true</xmlreport>
> </configuration>
> </plugin>
> </plugins>
> </reporting>
>
> Now the plugin calls on the app to load up a spring applicationcontext
> via:
>
> ClassPathXmlApplicationContext cContext = new
> ClassPathXmlApplicationContext(string[]);
>
> but spring can not find the provided files and throws the:
>
> "class path resource [" + this.path + "]" + cannot be resolved to URL
> because it does not exist
>
> So, how do I put the context files for spring on the maven report plugin
> classpath?
>
> Thanks
>
> zach
>
>
>
>
>
--
View this message in context:
http://www.nabble.com/AbstractMavenReport-and-Spring-Context-Files-tp16011742s177p16019888.html
Sent from the Maven Developers mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]