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
 

Reply via email to