You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by javed mandary <ja...@gmail.com> on 2010/08/19 05:02:00 UTC

Re: Running a specific plugin goal from the command line in a sub-module of a multi-module reactor project

Hi Brian,
             assuming you have the following dependency structure:

Root
     |
     |--------Module A
     |--------Module B

Say Root contains your Parent Pom and module A and B are child sub modules
for the Parent and that you've defined Root as a parent pom for both Module
A and Module B.

 If you are going to run a command on say Module B , then maven will look
for the Root module's  meta data from your local repository , if you haven't
previously built the Root module then it will try to download Root Pom from
the repositories configured in Module B's pom or from your repositories
configured within your settings.xml.

So in theory you can perfectly be able to run your commands on your sub
modules provided that all the dependencies for the submodule is available in
you local repository or on your remote repositories.

However the cleanest build is always the one your do from the parent POM
that is Root .

kind regards,
  Javed


On Wed, Aug 11, 2010 at 7:11 PM, Brian Ferris <bd...@gmail.com> wrote:

> I'm looking for a general technique here, but let's give a specific
> example.
>  I have a multi-module project and I'd like to run the exec:java plugin
> from
> the command-line against one of the sub-modules of my project.
>
> I know one approach is that I can run "mvn install" on the whole project
> and
> then just go into the sub-module directory, run the exec:java command from
> the command line, and have artifacts resolved to my local repository.  But
> running "mvn install" all the time gets pretty tedious.
>
> What I'd really like is the ability to run exec:java against the Maven
> reactor, where the classpath is constructed from the active modules of the
> project in the Maven reactor.  The problem is that I'm not sure this is
> possible.  A naive approach is to run the exec:java goal from the root of
> the project, but this tries to run the plugin against every module in the
> project, as opposed to the target module I'm interested in.
>
> Any idea?  I know my motivating example was exec:java, but really there are
> a number of single plugin goals that I'd like to run against my project
> from
> time to time outside of the scope of the full build lifecycle.
>
> Thanks,
> Brian
>