maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "simon.kitching@chello.at" <simon.kitch...@chello.at>
Subject Re: upgrade from maven 1 to maven 2
Date Tue, 04 Mar 2008 10:03:32 GMT
David Delbecq schrieb:
> Hello,
>
> we have a few project here using maven 1. They become difficult to
> maintain when it come to using new plugins that are not available for
> maven 1. So we thought it might be time to switch to maven 2. Question
> is, considering about all projects are using preGoal/postGoal and
> personalized rules in maven.xml, what should i do with them? I read
> there is no equivalent of maven.xml, i need to use a plugin. Can I
> sort of embbed that plugin with the project that use it, or do i need
> to create a separate plugin project for each of our maven.xml, compile
> and deploy those plugin change everytime before compiling the main
> project (with maven 1, changes to maven.xml were immediate)? Also if
> someone can point me to documentation about converting that maven.xml
> to a plugin, it'll be great. Documentation here
> http://maven.apache.org/guides/mini/guide-m1-m2.html , section "what
> to do with maven.xml" point to error page (the pages seems to have
> been removed from maven site :( )
>
> example of such task of maven.xml here is, we have a project X that is
> a webapp. In a subdirectory of that webapp we need to copy all
> ressources of another project Y, and we need to merge the struts and
> web.xml configs (we use a xslt processor for that). Am not sure how
> easy that can be transfered to a plugin...
>
Maven2 has a different approach, with the concept of "lifecycle phases";
you need to read the available information on that first. See the
"getting started" guides here:
  http://maven.apache.org/guides/index.html

Then in many cases the hacks that use preGoal/postGoal can be removed
and replaced with a standard plugin. For example, to copy resources of
another project Y you would:
 * have Y install those resources as an artifact into the repository
 * in project X, use the maven-dependency-plugin to pull those resources
from the repository

Where you have something that just cannot be done with an existing
plugin, the easiest solution is usually to write an ant task to perform
the necessary work, then bind the maven-ant-plugin to an appropriate
*phase* of the build-cycle so that it runs at the appropriate time. See
the documentation on maven-ant-plugin, <executions> sections and (again)
the documentation about phases. Of course using ant tasks should be a
last resort..there are a *lot* of standard plugins available.

Hope this helps..

Regards,
Simon


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


Mime
View raw message