Sure, this is what I have put in my maven.xml:
<goal name="build:withdeps" description="Builds your module and all
it's SNAPSHOT dependencies">
<ant:echo>********************************************************************</ant:echo>
<ant:echo>Building this module (${pom.id}) with all it's
SNAPSHOT
dependencies</ant:echo>
<ant:echo>********************************************************************</ant:echo>
<ant:echo message="There are ${size(pom.dependencies)}
artifacts for
this project"/>
<j:forEach items="${pom.dependencies}" var="dep"
indexVar="depNumber">
<ant:echo message="Dependency ${depNumber}:
${dep.artifact}"/>
<ant:echo>${dep.version}</ant:echo>
<ant:echo>SNAPSHOT present?
${dep.version.contains('SNAPSHOT')}</ant:echo>
<j:if test="${dep.version.contains('SNAPSHOT')}">
<ant:echo>${dep.class.name}</ant:echo>
<j:set var="idString" value="${dep.id}"/>
<j:set var="splittedStrings"
value="${idString.split(':')}"/>
<j:forEach items="${splittedStrings}"
var="string" indexVar="stringNr">
<j:if test="${stringNr == 0}">
<j:set var="group"
value="${string}"/>
</j:if>
<j:if test="${stringNr == 1}">
<j:set var="module"
value="${string}"/>
</j:if>
</j:forEach>
<ant:echo>Group: ${group}</ant:echo>
<ant:echo>Module: ${module}</ant:echo>
<ant:echo>Starting build in dir:
${basedir}/../../../${group}/${module}/build</ant:echo>
<maven:maven
descriptor="${basedir}/../../../${group}/${module}/build/project.xml"
goals="build:withdeps"/>
</j:if>
</j:forEach>
<ant:echo>Done building SNAPSHOT dependencies, now building
actual
module...</ant:echo>
<attainGoal name="artifact:install"/>
</goal>
Some important remarks:
- It only runs when using JDK 1.5 because I use the new split()
function. This can probably easily be changed to use substring() and
indexOf() functions.
- the <maven:maven/> tag will require your attention. You need a way
to go from your current directory (with your project.xml) to the
directory of the dependent module's project.xml. This will depend on
how you structure your modules.
hope it helps,
Wim
2005/6/15, Jim Mochel <[EMAIL PROTECTED]>:
> Wim,
>
> Could you post your resulting goal(s) here so that others seeking to do
> the same can benefit from your work ?
>
> Thanks,
>
> Jim
>
> Wim Deblauwe <[EMAIL PROTECTED]>
> 06/15/2005 06:34 AM
> Please respond to
> "Maven Users List"
>
> To
> Maven Users List <[email protected]>
> cc
>
> Subject
> Re: Building a project and it's SNAPSHOT dependencies
>
> ok, thanks got it working now.
>
> 2005/6/15, Vincent Massol <[EMAIL PROTECTED]>:
> > Ok, I understand. Well, you can still use the <maven:maven> tag...
> >
> > -Vincent
> >
> > > -----Original Message-----
> > > From: Wim Deblauwe [mailto:[EMAIL PROTECTED]
> > > Sent: mercredi 15 juin 2005 10:00
> > > To: Maven Users List
> > > Subject: Re: Building a project and it's SNAPSHOT dependencies
> > >
> > > Well, I use the multiproject plugin, but this builds *all* modules. I
> > > can ofcourse tweak this to include or exclude as many as I want but
> > > this is not convenient for what I want.
> > >
> > > I want to build a project with all it's dependent (and only it's
> > > dependent modules, not others) snapshot dependencies. I want this to
> > > be sure I have the latest of everything when I build my project. Note
> > > that all my modules are at the same level:
> > >
> > > + modules
> > > |
> > > + -- module1
> > > + -- module2
> > > + -- module3
> > >
> > > Suppose module3 only depends on module1. Using multiproject would
> > > build all 3. I want to have a system that when I am in the module3
> > > directory, I tell maven to build with a special command and it would
> > > first do a jar:install of module1 and of module3.
> > >
> > > regards,
> > >
> > > Wim
> > >
> > >
> > > 2005/6/15, Vincent Massol <[EMAIL PROTECTED]>:
> > > > Wim,
> > > >
> > > > You should use the multiproject plugin for that. Now to do what you
> want
> > > you
> > > > need to use the <maven:maven> tag to spawn a maven process.
> > > >
> > > > -Vincent
> > > >
> > > > > -----Original Message-----
> > > > > From: Wim Deblauwe [mailto:[EMAIL PROTECTED]
> > > > > Sent: mercredi 15 juin 2005 09:07
> > > > > To: Maven Users List
> > > > > Subject: Building a project and it's SNAPSHOT dependencies
> > > > >
> > > > > Hi,
> > > > >
> > > > > I'm writing a jelly script for building a project and also
> building
> > > > > it's dependencies in 1 go. I currently do this:
> > > > >
> > > > > <goal name="build:withdeps" description="Builds your module
> and
> > > all
> > > > > it's SNAPSHOT dependencies">
> > > > > <ant:echo>Building this module (${pom.id}) with all
> it's
> > > > > SNAPSHOT
> > > > > dependencies</ant:echo>
> > > > > <ant:echo message="There are
> ${size(pom.dependencies)}
> > > > > artifacts for
> > > > > this project"/>
> > > > > <j:forEach items="${pom.dependencies}" var="dep"
> > > > > indexVar="depNumber">
> > > > > <ant:echo message="Dependency ${depNumber}:
> > > > > ${dep.artifact}"/>
> > > > > <ant:echo>${dep.version}</ant:echo>
> > > > > <ant:echo>SNAPSHOT present?
> > > > > ${dep.version.contains('SNAPSHOT')}</ant:echo>
> > > > > <j:if
> > > test="${dep.version.contains('SNAPSHOT')}">
> > > > > <!--<attainGoal
> name="build:withdeps"
> > > />-->
> > > > > </j:if>
> > > > > </j:forEach>
> > > > > <attainGoal name="jar:install"/>
> > > > > </goal>
> > > > >
> > > > > This works to find out what modules need to be build, but then I
> am
> > > > > stuck. I want to start my goal "build:withdeps" in the directory
> of
> > > > > the dependency so that one gets build (and if it also has snapshot
> > > > > dependencies, those get build first). Is there a way to do this?
> > > > >
> > > > > regards,
> > > > >
> > > > > Wim
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> __________________________________________________________________________
> > > _
> > > > Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo!
> > > Messenger
> > > > T�l�chargez cette version sur http://fr.messenger.yahoo.com
> > > >
> > > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> ___________________________________________________________________________
> > Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo!
> Messenger
> > T�l�chargez cette version sur http://fr.messenger.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]