I was able to fix it by creating a custom URLClassLoader

/*
         * we should only need the generated classes from the main Output
         * directory
         */
        URL[] urls = new URL[] { this.getOutputDirectory().toURI().toURL()
};

        /*
         * Creates a URLClassLoader using as parent the current class
loader.
         */
        URLClassLoader classLoader = new URLClassLoader(urls, Thread
                .currentThread().getContextClassLoader());

        Thread.currentThread().setContextClassLoader(classLoader);

If you guys have a more elegant way to do it via maven, maybe maven already
has something like this and
I can just enable one property?

Thanks,

Joao

On Sat, Dec 20, 2008 at 11:59 PM, João Kreuzberg <[email protected]>wrote:

> Hello Martin,
>
> could you give me a hint on how that would look like?
>
> I'm not sure how this would look like on the plugin..
>
> Thanks
>
> Joao
>
>
> On Sat, Dec 20, 2008 at 5:57 PM, Martin Gainty <[email protected]>wrote:
>
>>
>> put in location pointed to by java.class.path (before other class paths)
>>
>> http://jira.codehaus.org/secure/attachment/38657/guide-maven-classloading.aptMartin______________________________________________
>>  Disclaimer and
>> confidentiality note Everything in this e-mail and any attachments relates
>> to the official business of Sender. This transmission is of a confidential
>> nature and Sender does not endorse distribution to any party other than
>> intended recipient. Sender does not necessarily endorse content contained
>> within this transmission. > Date: Sun, 21 Dec 2008 06:21:33 +1030> From:
>> [email protected]> To: [email protected]> Subject: Re: [LOADING
>> CLASS]> > On Sun, Dec 21, 2008 at 12:58 AM, João Kreuzberg <
>> [email protected]> wrote:> > Thanks for the quick response,> >> > This
>> is what I have on my mojo:> >> > *> > * @goal model-to-files> > *> > *
>> @phase compile> > *> > * @requiresDependencyResolution compile> >> > I tried
>> all compile/runtime but I can't still load classes by their names.> >> > Any
>> hints?> >> > Do I need to look up on some special class loader within maven
>> built-in> > libraries?> > Sorry I dont know.> Suggest looking at plugins
>> that do this.> > e.g.> svn:
>> http://svn.apache.org/repos/asf/maven/plugins/tags/maven-checkstyle-plugin-2.2>
>> or> clover> jxr> pmd> > They might have the bits you need to know.> >
>> ---------------------------------------------------------------------> To
>> unsubscribe, e-mail: [email protected]> For additional
>> commands, e-mail: [email protected]>
>> _________________________________________________________________
>> Life on your PC is safer, easier, and more enjoyable with Windows Vista(R).
>> http://clk.atdmt.com/MRT/go/127032870/direct/01/
>
>
>
>
> --
> Ivanir João Kreuzberg
>



-- 
Ivanir João Kreuzberg

Reply via email to