maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JF <>
Subject Writing a component for a Maven Plugin
Date Wed, 23 Nov 2011 09:49:04 GMT
I wish to write a component to inject into my Maven Mojo whichis running 
from an 'embedded' Maven deployment.
By embedded I mean I am starting up Plexus and Maven like this...

import org.apache.maven.Maven;
import org.apache.maven.cli.MavenLoggerManager;
import org.apache.maven.model.building.ModelProcessor;
import org.codehaus.plexus.DefaultContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusContainerException;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;

public class MvnServer2
     final Logger logger;
     final BespokeExecutionListener executionListener;
     final Maven maven;
     final ModelProcessor modelProcessor;

     MvnServer2() throws PlexusContainerException, 
ComponentLookupException {
         ClassWorld classWorld = new ClassWorld("plexus.core",
         DefaultContainerConfiguration cc =
             new DefaultContainerConfiguration();

         DefaultPlexusContainer plexus = new DefaultPlexusContainer(cc);
         logger = new ConsoleLogger();
         plexus.setLoggerManager(new MavenLoggerManager(logger));

         maven = plexus.lookup(Maven.class);
         modelProcessor = plexus.lookup(ModelProcessor.class);

         executionListener = new BespokeExecutionListener(logger);

I was looking at 
but noticed that the archetypes and documentation at seems 
to be out of date. I also see that sonatype are migrating to Guice.
Which would be a better place to start for component writing, Guice or 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message