Does Maven 2.x support pre/postGoals?
Maven 2.x no longer supports pre/postGoals, which were used in Maven 1.x to inject custom behavior to the build process. This caused a problem, since declaring your code to be a preGoal of some other goal meant that you depended on that specific goal, rather than the work it did. It also caused confusion when trying to inject other behavior into a build that already had pre/postGoals attached: Where would the new behavior be injected? Pre- and post-goals in Maven 1.x were usually used to develop the concept of a workflow, or lifecycle, for the build, where x happened before y, which had to happen before the sources could be compiled. In Maven 2, we’ve incorporated this concept of a build lifecycle natively. The steps – or phases – in this lifecycle correspond to the types of actions that might occur in a build. Your plugin can declare which type of action it performs – or which phase it should bind to – and that will guarantee it is executed before the next action type.