getPluginContext() is the one you want. Use that to stash your info.
On 24 July 2013 15:15, Francesco Mari <mari.france...@gmail.com> wrote: > Thank you for the link, but I don't need to coordinate multiple projects in > the same session. My use case is only focused on one project. > > What about serializing the information somewhere in the > ${project.build.directory} folder? > > Are there any issues I should aware of if I implement this solution? > > > 2013/7/24 Stephen Connolly <stephen.alan.conno...@gmail.com> > > > 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 <m...@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.conno...@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.france...@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? > > > > > > > > > > > > > > >