I got your suggestion, the source code is here. I can use this way to
generate a new LifecycleMapping.
but I don't understand why jar/ejb/rar/war packaging are not use this way,
are they hard code in the Maven-Core project?

 private Object findExtension( MavenProject project, String role, String
> roleHint, Settings settings,
>
                                  ArtifactRepository localRepository )
>
        throws LifecycleExecutionException, PluginNotFoundException
>
    {
>
        Object pluginComponent = null;
>

>         for ( Iterator i = project.getBuildPlugins().iterator();
> i.hasNext() && pluginComponent == null; )
>
        {
>
            Plugin plugin = (Plugin) i.next();
>

>             if ( plugin.isExtensions() )
>
            {
>
                verifyPlugin( plugin, project, settings, localRepository );
>

>                 // TODO: if moved to the plugin manager we already have the
> descriptor from above and so do can lookup the container directly
>
                try
>
                {
>
                    pluginComponent = pluginManager.getPluginComponent(
> plugin, role, roleHint );
>
                }
>
                catch ( ComponentLookupException e )
>
                {
>
                    getLogger().debug( "Unable to find the lifecycle
> component in the extension", e );
>
                }
>
                catch ( PluginManagerException e )
>
                {
>
                    throw new LifecycleExecutionException(
>
                        "Error getting extensions from the plugin '" +
> plugin.getKey() + "': " + e.getMessage(), e );
>
                }
>
            }
>
        }
>
        return pluginComponent;
>
    }
>

2008/9/26 Stephen Connolly <[EMAIL PROTECTED]>

> You need to mark your plugin as an extension
>
> something like
> <project>
>  <groupId>test</groupId>
>  <artifactId>test</artifactId>
>  <version>0.1-SNAPSHOT</version>
>  <pachaking>chensimiao</packaging>
> <build>
>  <plugins>
>    <plugin>
>      <groupId>com.gmail.chensimiao</groupId>
>      <artifactId>chensimiao-maven-plugin</artifactId>
>      <version>1.0-SNAPSHOT</version>
>      <extension>true</extension>
>    </plugin>
> </build>
> </project>
>
> that way maven knows that it should look in
> com.gmail.chensimiao:chensimiao-maven-plugin:1.0-SNAPSHOT:jar for the
> /META-INF/org.apache.maven.lifecycle.mapping.LifecycleMapping.chensimiao
> file
>
> On 26 September 2008 09:25, 陈思淼 <[EMAIL PROTECTED]> wrote:
>
> > I traced the source core of maven and that the Maven-core will look up
> > for componentManagerManager by the key
> > "org.apache.maven.lifecycle.mapping.LifecycleMapping"+packaging_type,Im
> > sure
> > the default packaging type ,jar,ear,rar for example, have register to the
> > PlexusContainer. but I don't know how and when to inject
> > that LifecycleMapping componentManager to the container? and how I I
> inject
> > my own LifecycleMapping componentManager to the container.
> > Is there Maven plugin developer can tell me some detail about this?
> > Thank you very Much.
> >
> >
> > 2008/9/26 <[EMAIL PROTECTED]>
> >
> > > I think you will find the Repo infos there:
> > >
> > > http://plexus.codehaus.org/source-repository.html
> > >
> > >
> > > - jens
> > >
> > >
> > >
> > > >I want to define a new packaging type called jcar to package my own
> > > project.
> > > >i read the maven source , and find the maven-core use
> > > >PlexusContainer.lookup() to find a new LifecycleMapping
> > > >to, can anybody tell me how that process works? and where to download
> > > >PlexusContainer source code so i can read
> > > >the detail of it.
> > > >thank you!
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
>

Reply via email to