En l'instant précis du 04/03/08 11:03, [EMAIL PROTECTED]
s'exprimait en ces termes:
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
Y can not be modified :) We just pump files from it, so changing it so
it uses maven 2 and publish the needed ressources is nogo.
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.
That could be a good solution i'll investigate, most our maven.xml codes
are already using nearly exclusively ant tasks, thanks for suggestion.
Does that ant taks also support jelly rules? We have foreach rules, that
cycle on a 'toMerge' list of file that need to be processed by our xslt
ant task. I understand it wouldn't be the best way, but we need a
working way that need as little changes as possible to current rules so
as to minimize risks of non working rules. As i see in docs, lifecycle
is not that much different from pre/post goal, i suppose everything done
in postGoal for war-resources could be attached somewhere at end of
prepare-package lifecycle.
Hope this helps..
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
David Delbecq
Institut Royal Météorologique
Ext:557
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]