[prev in list] [next in list] [prev in thread] [next in thread] 

List:       maven-dev
Subject:    Re: Plugin development: how to get the phase
From:       John Petritis <john.petritis () lggm ! com>
Date:       2007-07-31 14:01:07
Message-ID: 11924625.post () talk ! nabble ! com
[Download RAW message or body]


Thanks, I will keep an eye out for John's build plan work (I assume it won't
be available until some major release).
If we were working under Linux I could probably tee the output then gawk it
to find what project and phase it was working on and then used that to
generate what I need.

For now I have put together a plugin echos what project and phase is being
executed (it also shows a timestamp).
I just have an <execution> block for each phase, and inside it a
<configuration> variable that has the name of the phase.

Thanks Again.

P.S. If it isn't obvious, I am a maven newbie



Jason van Zyl-2 wrote:
> 
> 
> On 30 Jul 07, at 2:59 PM 30 Jul 07, John Petritis wrote:
> 
> > 
> > Here is why:
> > 
> 
> Sure, I'm just saying that to do any of this the plugin doesn't need  
> to know anything about the phase it's running in. This is definitely  
> something you would want to do from a lifecycle perspective. If you  
> want the output of a typical build you can see what phase is running  
> and what is happening (probably too much). But there is no way to a  
> plugin to know what phase its in and is not something I see us every  
> giving a mojo access to. It should be done at a higher level. The  
> work John is doing on the build plan is something that could  
> eventually be instrumented to provide full statistics. So the idea is  
> that for a given configuration you get a build plan, it can be  
> inspected and modified before being executed, once executed we could  
> easily add in some listeners. Currently there is nothing in place to  
> do what you need in a decent way.
> 
> > It (my plugin) will be be run in multiple phases, and needs to log:
> > 
> > - what pom is being made
> > - what phase it is in
> > - the time my plugin is run
> > 
> > There are parts of our build that can take a very long time to run if
> > certain problems occur.
> > By monitoring a log of when some various points are reached, I can  
> > tell if
> > it is worth stopping the the build then doing some housekeeping so  
> > it will
> > run much faster, and then restarting it after the housekeeping.
> > 
> > 
> > 
> > Perhaps I can set values to be passed into it based on what phase  
> > it is
> > being used, but then that makes it more work to set up.
> > 
> > 
> > 
> > Jason van Zyl-2 wrote:
> > > 
> > > 
> > > On 30 Jul 07, at 1:18 PM 30 Jul 07, John Petritis wrote:
> > > 
> > > > 
> > > > I need to be able to get the phase my plugin is run in.
> > > 
> > > Why?
> > > 
> > > There is no way to get the phase a plugin is running in as you
> > > generally declare that from the outside i.e. a workflow that the mojo
> > > takes part in.
> > > 
> > > > I will probably make it run in multiple phases.
> > > > I would prefer to get the phase from an @parameter expression="$ 
> > > > {???}"
> > > > But I cannot figure out what variable name to use in it.
> > > > 
> > > > (I am basically trying to make a logger that tracks when maven  
> > > > gets to
> > > > various phases of various projects)
> > > > 
> > > > Thank You
> > > > -- 
> > > > View this message in context: http://www.nabble.com/Plugin-
> > > > development%3A-how-to-get-the-phase-tf4171209s177.html#a11866794
> > > > Sent from the Maven Developers mailing list archive at Nabble.com.
> > > > 
> > > > 
> > > > -------------------------------------------------------------------- 
> > > > -
> > > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: dev-help@maven.apache.org
> > > > 
> > > 
> > > Thanks,
> > > 
> > > Jason
> > > 
> > > ----------------------------------------------------------
> > > Jason van Zyl
> > > Founder and PMC Chair, Apache Maven
> > > jason at sonatype dot com
> > > ----------------------------------------------------------
> > > 
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
> > > 
> > > 
> > > 
> > 
> > -- 
> > View this message in context: http://www.nabble.com/Plugin- 
> > development%3A-how-to-get-the-phase-tf4171209s177.html#a11881846
> > Sent from the Maven Developers mailing list archive at Nabble.com.
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> > 
> 
> Thanks,
> 
> Jason
> 
> ----------------------------------------------------------
> Jason van Zyl
> Founder and PMC Chair, Apache Maven
> jason at sonatype dot com
> ----------------------------------------------------------
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: \
http://www.nabble.com/Plugin-development%3A-how-to-get-the-phase-tf4171209s177.html#a11924625
 Sent from the Maven Developers mailing list archive at Nabble.com.


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic