You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Ben McCann <bm...@google.com> on 2011/03/10 04:45:54 UTC

Packaging Struts apps in deployment jars

Hi,

I did a lot of the development on the Google Guice and GXP plugins.
Unfortunately, I've found that we cannot use both of these together
internally.  What we do at Google to package apps for deployment is unzip
all the jars and then rezip them all together into a single jar.  This is
really nice since there is only a single jar to keep track of for each
binary.  However, it means we can't use more than a single Struts 2 plugin
since each plugin has its own struts-plugin.xml at the root of the jar and
they collide.

I'd like to update the Google Guice and GXP plugins so that we can use both
of them and was wondering if there were any recommendations.  I was thinking
of doing something like moving the struts-plugin.xml files to reside in our
packages (e.g. com.google.inject.extensions.struts2) and the loading them
with something like:
com.opensymphony.xwork.config.ConfigurationManager.addConfigurationProvider(new
XmlConfigurationProvider(strutsPluginPath));

However, I see that ConfigurationManager.addConfigurationProvider has been
updated and is no longer static.  Also, I wasn't sure how I could trigger
this code to be called.  Any ideas on what I might be able to do?

Thanks,
Ben

Re: Packaging Struts apps in deployment jars

Posted by Wes Wannemacher <we...@wantii.com>.
I can't really outline a full solution, because I don't have much time
to research this, but check here -

http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java?view=markup

Around line 342, you can see where the Dispatcher loads custom
configuration providers. I would imagine that you could create another
configuration provider that is nearly identical to
StrutsXmlConfigurationProvider (GoogleStrutsXmlConfigurationProvider
?). That finds the XML files where you want them to be found. Then,
you need to specify your custom configuration provider class as an
init param.

-Wes

On Thu, Mar 10, 2011 at 1:18 AM, Ben McCann <bm...@google.com> wrote:
> It crossed my mind, but I didn't think it'd go over real well to build a
> special case into our build system just for struts plugins.
>
>
> On Wed, Mar 9, 2011 at 10:12 PM, Chris Pratt <th...@gmail.com>wrote:
>
>> How about just merging the struts-plugin.xml files.
>>   (*Chris*)
>>
>> On Wed, Mar 9, 2011 at 7:45 PM, Ben McCann <bm...@google.com> wrote:
>>
>> > Hi,
>> >
>> > I did a lot of the development on the Google Guice and GXP plugins.
>> > Unfortunately, I've found that we cannot use both of these together
>> > internally.  What we do at Google to package apps for deployment is unzip
>> > all the jars and then rezip them all together into a single jar.  This is
>> > really nice since there is only a single jar to keep track of for each
>> > binary.  However, it means we can't use more than a single Struts 2
>> plugin
>> > since each plugin has its own struts-plugin.xml at the root of the jar
>> and
>> > they collide.
>> >
>> > I'd like to update the Google Guice and GXP plugins so that we can use
>> both
>> > of them and was wondering if there were any recommendations.  I was
>> > thinking
>> > of doing something like moving the struts-plugin.xml files to reside in
>> our
>> > packages (e.g. com.google.inject.extensions.struts2) and the loading them
>> > with something like:
>> >
>> >
>> com.opensymphony.xwork.config.ConfigurationManager.addConfigurationProvider(new
>> > XmlConfigurationProvider(strutsPluginPath));
>> >
>> > However, I see that ConfigurationManager.addConfigurationProvider has
>> been
>> > updated and is no longer static.  Also, I wasn't sure how I could trigger
>> > this code to be called.  Any ideas on what I might be able to do?
>> >
>> > Thanks,
>> > Ben
>> >
>>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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


Re: Packaging Struts apps in deployment jars

Posted by Ben McCann <bm...@google.com>.
It crossed my mind, but I didn't think it'd go over real well to build a
special case into our build system just for struts plugins.


On Wed, Mar 9, 2011 at 10:12 PM, Chris Pratt <th...@gmail.com>wrote:

> How about just merging the struts-plugin.xml files.
>   (*Chris*)
>
> On Wed, Mar 9, 2011 at 7:45 PM, Ben McCann <bm...@google.com> wrote:
>
> > Hi,
> >
> > I did a lot of the development on the Google Guice and GXP plugins.
> > Unfortunately, I've found that we cannot use both of these together
> > internally.  What we do at Google to package apps for deployment is unzip
> > all the jars and then rezip them all together into a single jar.  This is
> > really nice since there is only a single jar to keep track of for each
> > binary.  However, it means we can't use more than a single Struts 2
> plugin
> > since each plugin has its own struts-plugin.xml at the root of the jar
> and
> > they collide.
> >
> > I'd like to update the Google Guice and GXP plugins so that we can use
> both
> > of them and was wondering if there were any recommendations.  I was
> > thinking
> > of doing something like moving the struts-plugin.xml files to reside in
> our
> > packages (e.g. com.google.inject.extensions.struts2) and the loading them
> > with something like:
> >
> >
> com.opensymphony.xwork.config.ConfigurationManager.addConfigurationProvider(new
> > XmlConfigurationProvider(strutsPluginPath));
> >
> > However, I see that ConfigurationManager.addConfigurationProvider has
> been
> > updated and is no longer static.  Also, I wasn't sure how I could trigger
> > this code to be called.  Any ideas on what I might be able to do?
> >
> > Thanks,
> > Ben
> >
>

Re: Packaging Struts apps in deployment jars

Posted by Chris Pratt <th...@gmail.com>.
How about just merging the struts-plugin.xml files.
  (*Chris*)

On Wed, Mar 9, 2011 at 7:45 PM, Ben McCann <bm...@google.com> wrote:

> Hi,
>
> I did a lot of the development on the Google Guice and GXP plugins.
> Unfortunately, I've found that we cannot use both of these together
> internally.  What we do at Google to package apps for deployment is unzip
> all the jars and then rezip them all together into a single jar.  This is
> really nice since there is only a single jar to keep track of for each
> binary.  However, it means we can't use more than a single Struts 2 plugin
> since each plugin has its own struts-plugin.xml at the root of the jar and
> they collide.
>
> I'd like to update the Google Guice and GXP plugins so that we can use both
> of them and was wondering if there were any recommendations.  I was
> thinking
> of doing something like moving the struts-plugin.xml files to reside in our
> packages (e.g. com.google.inject.extensions.struts2) and the loading them
> with something like:
>
> com.opensymphony.xwork.config.ConfigurationManager.addConfigurationProvider(new
> XmlConfigurationProvider(strutsPluginPath));
>
> However, I see that ConfigurationManager.addConfigurationProvider has been
> updated and is no longer static.  Also, I wasn't sure how I could trigger
> this code to be called.  Any ideas on what I might be able to do?
>
> Thanks,
> Ben
>