maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Connolly <stephen.alan.conno...@gmail.com>
Subject Re: Passing information between goals
Date Wed, 24 Jul 2013 14:00:33 GMT
Ahh yes... that's the one... I spent 3-5 min searching for it.

getPluginContext() is the map you want (unless you want to span modules...
even then I think you can cheat slightly by doing some funky stuff)


On 24 July 2013 14:20, Baptiste MATHUS <ml@batmat.net> wrote:

> Hi,
>
> I remember doing that for build-helper. It was for many executions of the
> same mojo though, not sure how it behaves with different mojos.
> See
>
> http://mojo.10943.n7.nabble.com/build-helper-m-p-thread-safety-issue-td39561.htmland
> the ReserveListenerPortMojo
>
> My 2 cents.
>
> Cheers
> Le 24 juil. 2013 14:17, "Stephen Connolly" <
> stephen.alan.connolly@gmail.com>
> a écrit :
>
> > This is generally a tad tricky.
> >
> > 1. Because of class unloading it may not be possible to use the Hack-type
> > solution of stashing the data in a Class level static field. Though that
> > solution will work as long as the field uses a collection type that
> allows
> > for GC when the MavenProject that it is caching a value for has been
> > collected by GC (think of the users of Maven Embedder who's Maven process
> > may be long lived and reused multiple times)
> >
> > 2. Easiest way may just be to serialize the value into a string form and
> > set a project property with a non-maven resolvable name to the string
> > value. For example I do not think it is possible to have a Maven property
> > start with the null character.
> >
> > You code will need to be defensive, and if the property (or cache value
> if
> > you go route 1) is missing it will have to calculate the value from
> scratch
> >
> >
> > On 24 July 2013 12:57, Francesco Mari <mari.francesco@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I wrote some MOJOs which use common data. This data depends on the
> > > structure of the project and can't be changed at runtime.
> > >
> > > I would like to compute this information at the beginiing of the build
> > > process, and re-use it in each related goal. Ideally, the first goal
> > should
> > > compute the data, and the following ones will just use it.
> > >
> > > Which is the best option? Are there any plugins already implementing
> > such a
> > > strategy, so I can take a look at their source code?
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message