You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Pulkit Singhal <pu...@gmail.com> on 2010/12/20 18:20:43 UTC

How to build sub-modules selectively?

With a structure like the following:

umbrella-module
> core-module
> optional-module-1
> optional-module-2

How can the maven pom files be configured so that a user can build:

1) either, core-module with configuration and jar files from
optional-module-1 as dependencies
2) or, core-module with configuration and jar files from
optional-module-2 as dependencies

based on what command is issued via the command line:
mvn install mod1 or mvn install mod2

I'm guessing that some sort of condition will need to be put into
place in the core-module's pom.xml file to let it know which
dependency it needs? Based on what is specified in an env variable or
on the command line? How can that condition be set up?

If there is a different / better approach to this, please let me know.

Thanks!

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


Re: How to build sub-modules selectively?

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 20/12/2010 1:11 PM, Wayne Fay wrote:
>> I'm guessing that some sort of condition will need to be put into
>> place in the core-module's pom.xml file to let it know which
>> dependency it needs? Based on what is specified in an env variable or
> Whenever you are looking for this kind of conditional building of your
> projects, you should immediately think of "profiles."
>
You should also think "Why are my modules optional?"

Am I really trying to build separate artifacts? Should I have a simple 
project that just builds the artifact with optional module 1 and another 
that just builds with optional module 2 rather than a project that is 
hopelessly complex and prone to errors and requires a lot of maintenance.

Am I mixing deployment environment information(properties, database 
connections, site info, web service endpoints) with code. This should 
not be done at all.


Ron

/Maven Profiles are like Good Intentions. They are far from evil but 
they both can pave the way to hell./

> This is well documented online if you just search for it.
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


Re: How to build sub-modules selectively?

Posted by Wayne Fay <wa...@gmail.com>.
> I'm guessing that some sort of condition will need to be put into
> place in the core-module's pom.xml file to let it know which
> dependency it needs? Based on what is specified in an env variable or

Whenever you are looking for this kind of conditional building of your
projects, you should immediately think of "profiles."

This is well documented online if you just search for it.

Wayne

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