You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ro...@innovations.de on 2009/08/24 14:31:53 UTC

How does org.apache.maven.plugin.ContextEnabled work?

Hi,

I have multiple plugins which work on a xml document, which can be quite
expensive to load and parse. To keep build times short, it would be good
if plugins could access a previously loaded document, so that a document
needs only be loaded and parsed once per build.

While looking how to achieve this, I stumbled upon
org.apache.maven.plugin.ContextEnabled which is implemented by
AbstractMojo. The JavaDoc states:

"Interface to allow Mojos to communicate with each others Mojos, other
than project's source root and project's attachment.
The plugin manager would pull the context out of the plugin container
context, and populate it into the Mojo."

It sounds like something I could use, so I tried to use this to share
the document. Unfortunately the context was always empty.
Am I missing something a configuration for this to work? Or does someone
maybe know a better solution to what I was trying to achieve?

Thanks in advance,

Robert


Robert Klaus
Business Rules Management
-- 
Innovations Software Technology GmbH
Bosch Group
Ziegelei 7, 88090 Immenstaad/GERMANY
Tel. +49 7545 202-339
Fax +49 7545 202-301
robert.klaus@innovations.de
www.innovations.de

Executives: Achim Berger, Thomas Cotic, Walter Pitz, Thomas Schmid 
Register Court Ulm HRB 631888
This message may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited. If
you are not the intended recipient, please inform us immediately and
destroy this message including all copies thereof. 



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


AW: How does org.apache.maven.plugin.ContextEnabled work?

Posted by Ro...@innovations.de.
Thanks for the answer. Seems to me that it doesn't do what I need.

Cheers,

Robert

> -----Ursprüngliche Nachricht-----
> Von: Martin Gainty [mailto:mgainty@hotmail.com]
> Gesendet: Montag, 24. August 2009 23:30
> An: users@maven.apache.org
> Betreff: RE: How does org.apache.maven.plugin.ContextEnabled work?
> 
> 
> Guten Tag
> 
> the example i  have seen acquires the getPluginContext in execute
> method for variable
> you have identified at command line specifically:
>    public void execute()
>         throws MojoExecutionException
>     {
> getPluginContext('maven-it-plugin-context-
> passing').getVariable('some.variable')}
>     }
> once compiled
> 
> call the maven-it-plugin-context-passing plugin at command line
> specifying some.variable value e.g.
> 
> mvn -DgroupId=org.apache.maven.its.plugins -DartifactId=maven-it-
> plugin-context-passing
> 
> -Dpackaging=plugin -Dversion=2.1-SNAPSHOT -Dsome.variable="some-
> variable" <goal>
> 
> Vielen Danke,
> Martin Gainty
> Ich habe viel Geld, weil ich gute Löhne zahle. - Bosch
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung
> 
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede
> unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig.
> Diese Nachricht dient lediglich dem Austausch von Informationen und
> entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten
> Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt
> uebernehmen.
> 
> 
> 
> 
> > Subject: How does org.apache.maven.plugin.ContextEnabled work?
> > Date: Mon, 24 Aug 2009 14:31:53 +0200
> > From: Robert.Klaus@innovations.de
> > To: users@maven.apache.org
> >
> > Hi,
> >
> > I have multiple plugins which work on a xml document, which can be
> quite
> > expensive to load and parse. To keep build times short, it would be
> good
> > if plugins could access a previously loaded document, so that a
> document
> > needs only be loaded and parsed once per build.
> >
> > While looking how to achieve this, I stumbled upon
> > org.apache.maven.plugin.ContextEnabled which is implemented by
> > AbstractMojo. The JavaDoc states:
> >
> > "Interface to allow Mojos to communicate with each others Mojos,
> other
> > than project's source root and project's attachment.
> > The plugin manager would pull the context out of the plugin container
> > context, and populate it into the Mojo."
> >
> > It sounds like something I could use, so I tried to use this to share
> > the document. Unfortunately the context was always empty.
> > Am I missing something a configuration for this to work? Or does
> someone
> > maybe know a better solution to what I was trying to achieve?
> >
> > Thanks in advance,
> >
> > Robert
> >
> >
> > Robert Klaus
> > Business Rules Management
> > --
> > Innovations Software Technology GmbH
> > Bosch Group
> > Ziegelei 7, 88090 Immenstaad/GERMANY
> > Tel. +49 7545 202-339
> > Fax +49 7545 202-301
> > robert.klaus@innovations.de
> > www.innovations.de
> >
> > Executives: Achim Berger, Thomas Cotic, Walter Pitz, Thomas Schmid
> > Register Court Ulm HRB 631888
> > This message may contain confidential and privileged information. Any
> > unauthorized review, use, disclosure or distribution is prohibited.
> If
> > you are not the intended recipient, please inform us immediately and
> > destroy this message including all copies thereof.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> 
> _________________________________________________________________
> With Windows Live, you can organize, edit, and share your photos.
> http://www.windowslive.com/Desktop/PhotoGallery

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


RE: How does org.apache.maven.plugin.ContextEnabled work?

Posted by Martin Gainty <mg...@hotmail.com>.
Guten Tag

the example i  have seen acquires the getPluginContext in execute method for variable 
you have identified at command line specifically:
   public void execute()
        throws MojoExecutionException
    {
getPluginContext('maven-it-plugin-context-passing').getVariable('some.variable')}
    }
once compiled

call the maven-it-plugin-context-passing plugin at command line specifying some.variable value e.g.

mvn -DgroupId=org.apache.maven.its.plugins -DartifactId=maven-it-plugin-context-passing

-Dpackaging=plugin -Dversion=2.1-SNAPSHOT -Dsome.variable="some-variable" <goal>

Vielen Danke,
Martin Gainty 
Ich habe viel Geld, weil ich gute Löhne zahle. - Bosch
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.




> Subject: How does org.apache.maven.plugin.ContextEnabled work?
> Date: Mon, 24 Aug 2009 14:31:53 +0200
> From: Robert.Klaus@innovations.de
> To: users@maven.apache.org
> 
> Hi,
> 
> I have multiple plugins which work on a xml document, which can be quite
> expensive to load and parse. To keep build times short, it would be good
> if plugins could access a previously loaded document, so that a document
> needs only be loaded and parsed once per build.
> 
> While looking how to achieve this, I stumbled upon
> org.apache.maven.plugin.ContextEnabled which is implemented by
> AbstractMojo. The JavaDoc states:
> 
> "Interface to allow Mojos to communicate with each others Mojos, other
> than project's source root and project's attachment.
> The plugin manager would pull the context out of the plugin container
> context, and populate it into the Mojo."
> 
> It sounds like something I could use, so I tried to use this to share
> the document. Unfortunately the context was always empty.
> Am I missing something a configuration for this to work? Or does someone
> maybe know a better solution to what I was trying to achieve?
> 
> Thanks in advance,
> 
> Robert
> 
> 
> Robert Klaus
> Business Rules Management
> -- 
> Innovations Software Technology GmbH
> Bosch Group
> Ziegelei 7, 88090 Immenstaad/GERMANY
> Tel. +49 7545 202-339
> Fax +49 7545 202-301
> robert.klaus@innovations.de
> www.innovations.de
> 
> Executives: Achim Berger, Thomas Cotic, Walter Pitz, Thomas Schmid 
> Register Court Ulm HRB 631888
> This message may contain confidential and privileged information. Any
> unauthorized review, use, disclosure or distribution is prohibited. If
> you are not the intended recipient, please inform us immediately and
> destroy this message including all copies thereof. 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 

_________________________________________________________________
With Windows Live, you can organize, edit, and share your photos.
http://www.windowslive.com/Desktop/PhotoGallery