You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sri Sankaran <Sr...@sas.com> on 2004/03/28 21:16:28 UTC

preGoals and prereqs

Using: Maven 1.0 rc2
 
Problem: Correct implementation of preGoal requires knowledge of the inner workings of the goal.
 
It is well known that a preGoal executes before the stated goal.  For example, the body of
 
<preGoal name="scm:checkout-project">
  do something here
</preGoal>
 
will execute before scm:checkout-project executes.  When one writes a preGoal the typical thinking is that one wants something to happen before the goal is executed; in other words, the goal itself is treated as a black box. What came as a revelation to me is that the preGoal does not execute before (any) prereqs for the stated goal.  
 
Consider again the example of the scm:checkout-project goal.  It happens to have a prereq of scm:validate.  
 
<goal name="scm:checkout-project" prereqs="scm:validate">
...
 
Maven will will execute the body of the above preGoal above before the execution of the actual scm:checkout-project goal but *after* the execution of scm:validate.
 
In my case what I really needed was a preGoal for scm:validate.  My argument against this policy is that implementation details of a goal should be just that.  Now, last week when I upgraded to 1.0rc2 I got burnt by this because the scm plugin's implementation had been refactored.  Now scm:validate has a prereq of scm:parse-connection. My build scripts failed because what I *now* need is a preGoal for scm:parse-connection.
 
Sigh...
 
Sri
 

Re: preGoals and prereqs

Posted by John Casey <jd...@commonjava.org>.
All I can say is that I've noticed this particular behavior as well, and
thought it to be pretty counter-intuitive, although I never considered
that it might break the encapsulation of the goal...a good point, I'd
say. While it might really break things on systems running RC2, I'd even
say it should be fixed to preserve the encapsulation...

-john

On Sun, 2004-03-28 at 14:16, Sri Sankaran wrote:
> Using: Maven 1.0 rc2
>  
> Problem: Correct implementation of preGoal requires knowledge of the inner workings of the goal.
>  
> It is well known that a preGoal executes before the stated goal.  For example, the body of
>  
> <preGoal name="scm:checkout-project">
>   do something here
> </preGoal>
>  
> will execute before scm:checkout-project executes.  When one writes a preGoal the typical thinking is that one wants something to happen before the goal is executed; in other words, the goal itself is treated as a black box. What came as a revelation to me is that the preGoal does not execute before (any) prereqs for the stated goal.  
>  
> Consider again the example of the scm:checkout-project goal.  It happens to have a prereq of scm:validate.  
>  
> <goal name="scm:checkout-project" prereqs="scm:validate">
> ...
>  
> Maven will will execute the body of the above preGoal above before the execution of the actual scm:checkout-project goal but *after* the execution of scm:validate.
>  
> In my case what I really needed was a preGoal for scm:validate.  My argument against this policy is that implementation details of a goal should be just that.  Now, last week when I upgraded to 1.0rc2 I got burnt by this because the scm plugin's implementation had been refactored.  Now scm:validate has a prereq of scm:parse-connection. My build scripts failed because what I *now* need is a preGoal for scm:parse-connection.
>  
> Sigh...
>  
> Sri
>  
-- 
John Casey
jdcasey@commonjava.org
CommonJava Open Components Project
http://www.commonjava.org


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