What's wrong with Wayne's first suggestion?

module1 *depends* on module3, so you *must* build module3 at some point
in time:
  cd module3
  mvn install

However now this module is built and the jar placed somewhere that
module1 can find it (under $HOME/.m2/ as it happens). You can therefore
build module1 repeatedly without rebuilding module3:
  cd module1
  mvn package
  .. hack code ..
  mvn package
  .. hack code ..
  mvn package

As for a maven commandline switch to build just one module of a parent
pom, maybe "--reactor" does this? I'm not sure as the description of
this option is rather vague but the "reactor" is a list of the projects
to be built, ie the set of modules defined, so "a project found in the
reactor" might be what you are looking for..

Regards,

Simon

On Fri, 2006-03-17 at 21:40 -0800, Pierre Monestie wrote:
> Wayne,
> The second way you describe is the way my project is defined.
> Assume I have a couple extra modules defined this way and I only want
> to build module1. If I issue mvn package all the modules will be build
> correct? My question is: Is there a command line switch to tell mvn to
> build only module1 (and it's dependencies). I know I could put  an
> ignore clause(or something like that) in the top level file but that's
> not really what I want.
> 
> Thanks,
> Pierre
> 
> On 3/17/06, Wayne Fay <[EMAIL PROTECTED]> wrote:
> > A few ways to do this...
> >
> > Assume you're starting from parent directory...
> > cd module3
> > mvn install
> > cd ..
> > cd module1
> > mvn package
> >
> > This will result in module1 being built and the resulting jar placed
> > in module1/target.
> >
> > OR
> >
> > Add to parent/pom.xml:
> >   <modules>
> >     <module>module3</module>
> >     <module>module2</module>
> >     <module>module1</module>
> >   </modules>
> >
> > Then make sure you have in module1/pom.xml:
> > <?xml version="1.0" encoding="iso-8859-1"?>
> > <project>
> >   <parent>
> >     <groupId>blah</groupId>
> >     <artifactId>parent</artifactId>
> >     <version>1.0.0</version>
> >   </parent>
> >   <modelVersion>4.0.0</modelVersion>
> >   <groupId>blah</groupId>
> >   <artifactId>module1</artifactId>
> >   <packaging>jar</packaging>
> >   <version>1.0.0</version>
> >   <dependencies>
> >     <dependency>
> >       <groupId>blah</groupId>
> >       <artifactId>module3</artifactId>
> >       <version>1.0.0</version>
> >       <scope>compile</scope>
> >       <type>jar</type>
> >    </dependency>
> >
> > And then issue a simple "mvn package" command from parent directory.
> > This will also place the resulting jar in the module1/target
> > directory.
> >
> > Wayne
> >
> >
> > On 3/17/06, Pierre Monestie <[EMAIL PROTECTED]> wrote:
> > > Hello,
> > > I've been looking all over for this and could not find any answer:
> > > In a multi module project how can I, from the parent level, build a
> > > specific module?
> > > Going into the child I want to build does not work as it refers to a 
> > > parent.
> > >
> > > For example I have:
> > > parent
> > >  --module1 (depends on module3)
> > >  --module2
> > >  --module3
> > >
> > > and I just want to build module1.
> > > Tell me this is possible plz :)
> > > Thanks in advance,
> > > Pierre
> > >
> > > ---------------------------------------------------------------------
> > > 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]

Reply via email to