You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jochen Kuhnle <jo...@kuhnle.net> on 2007/04/23 15:43:26 UTC

How to share data between plugins after 2.0.5 change to extensions handling?

Hi,

we use several plugins that need to share data. This as done by 
creating an extension containing some "container" classes, and adding 
an extension to the project's pom. These container classes are 
instantiated in a plugin using Plexus. However, since 2.0.5, this 
stopped working, because extensions now have their own container and 
the Plugin throws a NoClassDefFoundError.

Is there new way/workaround for this?

Regards,
Jochen



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: How to share data between plugins after 2.0.5 change to extensions handling?

Posted by Jochen Kuhnle <jo...@kuhnle.net>.
On 2007-04-24 15:25:48 +0200, Jason van Zyl <ja...@maven.org> said:

> 
> On 24 Apr 07, at 5:48 AM 24 Apr 07, Jochen Kuhnle wrote:
> 
>> Ok, did some further investigation: What I have is an extension  
>> containing a class (C). This class is referenced in the fields of  two 
>> different Mojos, the fields are not even initialized by Plexus.  
>> Looking at the new DefaultExtensionManager, I suppose this cannot  work 
>> any more, because the newly introduced extension container has  its own 
>> ClassRealm. When any of the plugins is instantiated by the  
>> PluginManager, I get a NoClassDefFoundError for class C.
>> 
>> Does this mean that I cannot access classes from extensions in a  
>> plugin any more? And that I cannot share data between plugins,  except 
>> by using JDK and Maven core classes?
>> 
>> This would be a major setback for us. We're using maven to build C+ + 
>> projects and wrote a bunch of plugins, which absolutely need to  share 
>> data.
>> 
> 
> Provided they are in the same plugin you can always use the plugin  context.
> 
> We also wrote a huge slew of plugins for C development and we created  
> a facility called the BuildContext for 2.1 because all these other  
> methods were brittle and we wanted a stated way to do it.
> 
> I'll think about a work around, you can probably use the plexus context.
> 

How about letting the extension specify where it wants to go, main 
container or extension container, with the last one as default? If 
that's ok, I can create a patch.

Regards,
Jochen



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: How to share data between plugins after 2.0.5 change to extensions handling?

Posted by Jason van Zyl <ja...@maven.org>.
On 24 Apr 07, at 5:48 AM 24 Apr 07, Jochen Kuhnle wrote:

> Ok, did some further investigation: What I have is an extension  
> containing a class (C). This class is referenced in the fields of  
> two different Mojos, the fields are not even initialized by Plexus.  
> Looking at the new DefaultExtensionManager, I suppose this cannot  
> work any more, because the newly introduced extension container has  
> its own ClassRealm. When any of the plugins is instantiated by the  
> PluginManager, I get a NoClassDefFoundError for class C.
>
> Does this mean that I cannot access classes from extensions in a  
> plugin any more? And that I cannot share data between plugins,  
> except by using JDK and Maven core classes?
>
> This would be a major setback for us. We're using maven to build C+ 
> + projects and wrote a bunch of plugins, which absolutely need to  
> share data.
>

Provided they are in the same plugin you can always use the plugin  
context.

We also wrote a huge slew of plugins for C development and we created  
a facility called the BuildContext for 2.1 because all these other  
methods were brittle and we wanted a stated way to do it.

I'll think about a work around, you can probably use the plexus context.

Jason.

> Regards,
> Jochen
>
> On 2007-04-24 04:04:40 +0200, Brett Porter <br...@apache.org> said:
>
>> An extension should still work there, as long as the things are   
>> instantiated in the extension itself - sounds like doing it in  
>> the  plugin is the problem. Is there a reason it must be there, or  
>> can you  use the plexus component lifecycle to do the instantiation?
>> Other than extensions, you can use plugin dependencies in most  
>> cases  (though doesn't sound suitable here). You might also be  
>> able to use  the plugin context to share the values instead of an  
>> extension  (though not if you are introducing new types, so  
>> probably not the  case here also).
>> - Brett
>> On 23/04/2007, at 3:43 PM, Jochen Kuhnle wrote:
>>> Hi,
>>> we use several plugins that need to share data. This as done by   
>>> creating an extension containing some "container" classes, and   
>>> adding an extension to the project's pom. These container  
>>> classes  are instantiated in a plugin using Plexus. However,  
>>> since 2.0.5,  this stopped working, because extensions now have  
>>> their own  container and the Plugin throws a NoClassDefFoundError.
>>> Is there new way/workaround for this?
>>> Regards,
>>> Jochen
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: How to share data between plugins after 2.0.5 change to extensions handling?

Posted by Jochen Kuhnle <jo...@kuhnle.net>.
Ok, did some further investigation: What I have is an extension 
containing a class (C). This class is referenced in the fields of two 
different Mojos, the fields are not even initialized by Plexus. Looking 
at the new DefaultExtensionManager, I suppose this cannot work any 
more, because the newly introduced extension container has its own 
ClassRealm. When any of the plugins is instantiated by the 
PluginManager, I get a NoClassDefFoundError for class C.

Does this mean that I cannot access classes from extensions in a plugin 
any more? And that I cannot share data between plugins, except by using 
JDK and Maven core classes?

This would be a major setback for us. We're using maven to build C++ 
projects and wrote a bunch of plugins, which absolutely need to share 
data.

Regards,
Jochen

On 2007-04-24 04:04:40 +0200, Brett Porter <br...@apache.org> said:

> An extension should still work there, as long as the things are  
> instantiated in the extension itself - sounds like doing it in the  
> plugin is the problem. Is there a reason it must be there, or can you  
> use the plexus component lifecycle to do the instantiation?
> 
> Other than extensions, you can use plugin dependencies in most cases  
> (though doesn't sound suitable here). You might also be able to use  
> the plugin context to share the values instead of an extension  (though 
> not if you are introducing new types, so probably not the  case here 
> also).
> 
> - Brett
> 
> On 23/04/2007, at 3:43 PM, Jochen Kuhnle wrote:
> 
>> Hi,
>> 
>> we use several plugins that need to share data. This as done by  
>> creating an extension containing some "container" classes, and  adding 
>> an extension to the project's pom. These container classes  are 
>> instantiated in a plugin using Plexus. However, since 2.0.5,  this 
>> stopped working, because extensions now have their own  container and 
>> the Plugin throws a NoClassDefFoundError.
>> 
>> Is there new way/workaround for this?
>> 
>> Regards,
>> Jochen
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: How to share data between plugins after 2.0.5 change to extensions handling?

Posted by Brett Porter <br...@apache.org>.
An extension should still work there, as long as the things are  
instantiated in the extension itself - sounds like doing it in the  
plugin is the problem. Is there a reason it must be there, or can you  
use the plexus component lifecycle to do the instantiation?

Other than extensions, you can use plugin dependencies in most cases  
(though doesn't sound suitable here). You might also be able to use  
the plugin context to share the values instead of an extension  
(though not if you are introducing new types, so probably not the  
case here also).

- Brett

On 23/04/2007, at 3:43 PM, Jochen Kuhnle wrote:

> Hi,
>
> we use several plugins that need to share data. This as done by  
> creating an extension containing some "container" classes, and  
> adding an extension to the project's pom. These container classes  
> are instantiated in a plugin using Plexus. However, since 2.0.5,  
> this stopped working, because extensions now have their own  
> container and the Plugin throws a NoClassDefFoundError.
>
> Is there new way/workaround for this?
>
> Regards,
> Jochen
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org