You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "KARR, DAVID (ATTSI)" <dk...@att.com> on 2010/11/09 21:36:08 UTC

Practical to have "optional" submodules, getting their artifacts from intranet repo if absent?

 I currently work on a large enterprise app built with Ant.  The app is
divided into several projects divided into functional areas.  In order
to build the entire EAR, all of the projects have to be built, even if
you're only working on a single one of those projects.

I'm examining how we could make this work better if we were using Maven.

I guess a straightforward implementation of this would have a main
project POM that specifies all the subprojects as submodules, and also
their artifacts as dependencies.

It almost seems to me that what I need is the ability to have the main
POM be somewhat "dynamic", such that if I'm only working on a single one
of those subprojects, but I need to assemble the EAR containing all of
the artifacts, then the projects that I don't have checked out would get
their submodule entry temporarily deleted, and I would get their
artifacts from the intranet repo.

I would be using m2eclipse.

Does any of this make sense?

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


Re: Practical to have "optional" submodules, getting their artifacts from intranet repo if absent?

Posted by Stephen Connolly <st...@gmail.com>.
I have used profiles activated by the presence of the pom.xml file in
the sub-module

so you have

if A/pom.xml exists then add module A
if B/pom.xml exists then add module B

-Stephen

On 9 November 2010 20:59, Ben Caradoc-Davies
<Be...@csiro.au> wrote:
> You can use profiles to enable the optional building of submodules (you can
> use a top-level aggregating pom if the projects are distinct). Note that, if
> you have built a module locally, maven will use the version from your local
> repo if it is newer than a deployed version. If not built locally, maven
> will download the dependency from a remote repo. I think this is what you
> want.
>
> When you run maven, specify -P options to enable profiles to turn on
> optional submodules. You can have multiple profiles active at once:
> http://maven.apache.org/guides/introduction/introduction-to-profiles.html
>
> As an example, GeoTools and GeoServer use profiles to enable the building of
> optional plugins. Here is the pom for unsupported GeoTools plugins:
> http://svn.osgeo.org/geotools/trunk/modules/unsupported/pom.xml
>
> A similar technique is used for GeoServer extensions:
> https://svn.codehaus.org/geoserver/trunk/src/extension/pom.xml
>
> Kind regards,
> Ben.
>
> On 10/11/10 06:36, KARR, DAVID (ATTSI) wrote:
>>
>>  I currently work on a large enterprise app built with Ant.  The app is
>> divided into several projects divided into functional areas.  In order
>> to build the entire EAR, all of the projects have to be built, even if
>> you're only working on a single one of those projects.
>>
>> I'm examining how we could make this work better if we were using Maven.
>>
>> I guess a straightforward implementation of this would have a main
>> project POM that specifies all the subprojects as submodules, and also
>> their artifacts as dependencies.
>>
>> It almost seems to me that what I need is the ability to have the main
>> POM be somewhat "dynamic", such that if I'm only working on a single one
>> of those subprojects, but I need to assemble the EAR containing all of
>> the artifacts, then the projects that I don't have checked out would get
>> their submodule entry temporarily deleted, and I would get their
>> artifacts from the intranet repo.
>>
>> I would be using m2eclipse.
>>
>> Does any of this make sense?
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> Ben Caradoc-Davies <Be...@csiro.au>
> Software Engineering Team Leader
> CSIRO Earth Science and Resource Engineering
> Australian Resources Research Centre
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Practical to have "optional" submodules, getting their artifacts from intranet repo if absent?

Posted by Ben Caradoc-Davies <Be...@csiro.au>.
You can use profiles to enable the optional building of submodules (you 
can use a top-level aggregating pom if the projects are distinct). Note 
that, if you have built a module locally, maven will use the version 
from your local repo if it is newer than a deployed version. If not 
built locally, maven will download the dependency from a remote repo. I 
think this is what you want.

When you run maven, specify -P options to enable profiles to turn on 
optional submodules. You can have multiple profiles active at once:
http://maven.apache.org/guides/introduction/introduction-to-profiles.html

As an example, GeoTools and GeoServer use profiles to enable the 
building of optional plugins. Here is the pom for unsupported GeoTools 
plugins:
http://svn.osgeo.org/geotools/trunk/modules/unsupported/pom.xml

A similar technique is used for GeoServer extensions:
https://svn.codehaus.org/geoserver/trunk/src/extension/pom.xml

Kind regards,
Ben.

On 10/11/10 06:36, KARR, DAVID (ATTSI) wrote:
>
>   I currently work on a large enterprise app built with Ant.  The app is
> divided into several projects divided into functional areas.  In order
> to build the entire EAR, all of the projects have to be built, even if
> you're only working on a single one of those projects.
>
> I'm examining how we could make this work better if we were using Maven.
>
> I guess a straightforward implementation of this would have a main
> project POM that specifies all the subprojects as submodules, and also
> their artifacts as dependencies.
>
> It almost seems to me that what I need is the ability to have the main
> POM be somewhat "dynamic", such that if I'm only working on a single one
> of those subprojects, but I need to assemble the EAR containing all of
> the artifacts, then the projects that I don't have checked out would get
> their submodule entry temporarily deleted, and I would get their
> artifacts from the intranet repo.
>
> I would be using m2eclipse.
>
> Does any of this make sense?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Ben Caradoc-Davies <Be...@csiro.au>
Software Engineering Team Leader
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre

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


Re: Practical to have "optional" submodules, getting their artifacts from intranet repo if absent?

Posted by Vincent Latombe <vi...@gmail.com>.
What you want can be achieved by having one big aggregator that contains all
your modules and your ears, and use the reactor feature.

By typing mvn -pl my-project:app -am, where my-project:app is the groupId of
your ear, you will actually build the ear and all its transitive
dependencies accross your whole reactor.

I would also add that in an environment where you have continuous
integration, with snapshots deployed regularly on a corporate repository,
the need to build everything from scratch will vanish as you will need to
build only what you changed and its downstream dependencies (-amd is very
useful for that)

Vincent


2010/11/9 KARR, DAVID (ATTSI) <dk...@att.com>

>
>  I currently work on a large enterprise app built with Ant.  The app is
> divided into several projects divided into functional areas.  In order
> to build the entire EAR, all of the projects have to be built, even if
> you're only working on a single one of those projects.
>
> I'm examining how we could make this work better if we were using Maven.
>
> I guess a straightforward implementation of this would have a main
> project POM that specifies all the subprojects as submodules, and also
> their artifacts as dependencies.
>
> It almost seems to me that what I need is the ability to have the main
> POM be somewhat "dynamic", such that if I'm only working on a single one
> of those subprojects, but I need to assemble the EAR containing all of
> the artifacts, then the projects that I don't have checked out would get
> their submodule entry temporarily deleted, and I would get their
> artifacts from the intranet repo.
>
> I would be using m2eclipse.
>
> Does any of this make sense?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>