Re: what's the PlexusContainer?

2008-09-26 Thread Stephen Connolly
Not really

when you flag your plugin as providing extensions, then it gets included
into the classloader which is used to look for LifecycleMapping definitions.

The default classloader already has the mapping files for jar/ejb/etc...

So it's no strictly speaking hard coded... more loosely coupled using
similar to the java SPI mechanism... but you can think of it as hard coded
effectively ;-)

2008/9/26 陈思淼 <[EMAIL PROTECTED]>

> 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
> > 
> >  test
> >  test
> >  0.1-SNAPSHOT
> >  chensimiao
> > 
> >  
> >
> >  com.gmail.chensimiao
> >  chensimiao-maven-plugin
> >  1.0-SNAPSHOT
> >  true
> >
> > 
> > 
> >
> > 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]
> > > >
> > > >
> > >
> >
>


Re: what's the PlexusContainer?

2008-09-26 Thread 陈思淼
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
> 
>  test
>  test
>  0.1-SNAPSHOT
>  chensimiao
> 
>  
>
>  com.gmail.chensimiao
>  chensimiao-maven-plugin
>  1.0-SNAPSHOT
>  true
>
> 
> 
>
> 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]
> > >
> > >
> >
>


Re: what's the PlexusContainer?

2008-09-26 Thread Stephen Connolly
You need to mark your plugin as an extension

something like

  test
  test
  0.1-SNAPSHOT
  chensimiao

  

  com.gmail.chensimiao
  chensimiao-maven-plugin
  1.0-SNAPSHOT
  true




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]
> >
> >
>


Re: what's the PlexusContainer?

2008-09-26 Thread 陈思淼
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]
>
>


RE: what's the PlexusContainer?

2008-09-26 Thread mac-systems
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]