maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maczka Michal <michal.mac...@imtf.ch>
Subject RE: Need to load common goals from sub-projects maven.xml
Date Wed, 30 Jun 2004 15:09:41 GMT
> 
> > No. Plugins are recommened way of doing this. 
> 
> I don't understand. Say I've got a persistence components 
> that requires
> XDoclet to be run prior to compiling then I might do this in 
> my maven.xml:
> 
>   <!-- Runs Xdoclet and then copies files to build directory-->  
>   <preGoal name="java:compile">
>     <attainGoal name="xdoclet:hibernatedoclet"/>
>       <echo message="${maven.build.dest}"/>
>       <copy todir="${maven.build.dest}">
>         <fileset dir="${maven.xdoclet.hibernatedoclet.destdir}"/>
>       </copy>   
>   </preGoal>
> 
> So if I then create 2 more persistence components that need 
> the same thing
> to happen then I might recognise a duplication and refactor 
> it out to a
> plugin. However, would I still need to do the following in each of my
> maven.xml's for my 3 components?
> 
>   <preGoal name="java:compile">
> 	<attainGoal name="myOwnPlugin:do-hibernate" />
>   </preGoal>
> 
> If these components were running inside the reactor wouldn't 
> it be better to
> simply put these lines in the parent project's maven.xml?
> 
> To answer my own question, having looked at some other 
> plugin.jelly, it
> seems that I could put the same preGoal into my plugin.jelly. 
> Is that what
> you you were getting at? Sorry for being slow.
> 

No! preGoals should not be used by plugins. 

At the moment indeed the solution which involves plugin requires very short
duplicating blocks in maven.xml.
Probably we will be able to eliminate the need for most of them and even
maven.xml themselves if we will have workflow 
which might be parametrized. E.g java:compile goal might depend on
java:runCodeGenerator goal which by default might be nop.
and you will be able to define alias java:runCodeGenerator - >
xdoclect:hibernatedoclet. 
So in the such common cases no scripting will be ever needed. 
But that's not yet official - that's just one of the possibilties.

Michal

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


Mime
View raw message