Trygve Laugstøl wrote:
Dennis Lundberg wrote:
Trygve Laugstøl wrote:
Dennis Lundberg wrote:
Jason van Zyl wrote:

On 24 Jun 06, at 6:25 PM 24 Jun 06, Dennis Lundberg wrote:

Hi

I want to be able to use the log instance returned from Mojo.getLog() in a class that is used by Mojo. The class itself is not a Mojo, but it is part of a plugin. Is there a best practice for this?


What is the class?

It's a part of the maven1 plugin in the sandbox that I'm working on. To separate matters into reasonable chunks of code there is currently:
 1  interface
 1  abstract implementation
10+ implementations

Sounds to me like you should make this a set of proper Plexus compomnents where you would get the logging and probably a lot of the instatiation/discoverry for free.

Take a look at for example the compiler plugin on how to write a Plexus component and how to use that in a Mojo.

Thanks Trygve. It looks like it would fit nicely with what I'm trying to do.

The compiler plugin doesn't have much in that respect though, at least what I could find. It does use plexus-compiler which contains plexus components for different compilers and then it uses CompilerManager to retrieve compilers.

What I'm not getting, and not finding at the plexus site either, is how to connect the mojo and the plexus component. I'm missing the lookup plumbing. Do I have to write my own manager for that, and if so how do I make my components known to the manager?

In addition to what Jason said, yes you will need a manager that will have the map of components like the CompilerManager.

Thanks,

I think that I've got the hang of things now. I looked at the plexus site and used plexus-compiler as a model for the work I'm doing.

There is one thing that I still can't quite understand though. In plexus-compiler there are no components.xml files. It seems to be using annotations instead. This is easier to read, but I can't get it to work. Do I need to add or upgrade some dependency to get this to work?

--
Dennis Lundberg


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to