You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Chris Beach <Ch...@aspectcapital.com> on 2012/06/15 10:43:27 UTC

How can I recursively build -SNAPSHOT dependencies present in the filesystem but outside the reactor?

I have two projects as follows, in neighbouring directories on the filesystem:

* project_a (-SNAPSHOT)
* project_b (-SNAPSHOT, depends on project_a)

I'd like to build project_b and for Maven to discover that project_a exists on the filesystem and thus build it rather than look in the local repo for its artifact.

I could build these within an aggregator and use the reactor to select project_b i.e.

mvn --projects project_b [goal]

However, this is problematic because

* this two-project example is a simplification of my real build, which consists of dozens of projects, and I don't want to have to maintain an aggregator project that lists all of them.
* I only want to recursively build -SNAPSHOT dependencies

Is there a neat way I could get Maven to perform a recursive build that looks on the filesystem to find -SNAPSHOT dependency projects and builds them?
I'm familiar with Maven plugin development, but haven't yet found any clues toward a solution in the Maven / Aether documentation.

Chris Beach

This email and any attachments contain CONFIDENTIAL information which may be legally privileged. If this 
communication constitutes a financial promotion, it is directed only at persons who are professional clients or 
eligible counterparties (as defined under the FSA rules).  The information, which is provided on a non-reliance 
basis, may be subject to verification or amendment.  No representation or warranty is made as to its accuracy or 
completeness. Unless expressly stated otherwise, this email is neither an offer to sell nor a solicitation of any 
offer to buy an interest in any fund or other investment vehicle sponsored or managed by Aspect Capital Limited 
(Aspect Funds). Any such offer or solicitation would be made only by way of the final offering documents of such 
Aspect Fund (which should be considered carefully before any investment decision is made) and only in such 
jurisdictions where, and to such persons to whom, it would be lawful to do so. Past performance is not necessarily 
indicative of future returns. Email transmission cannot be guaranteed to be secure or error free.  Subject to 
applicable law, Aspect (or its service providers) may intercept, monitor, review and retain e-communications 
travelling through its networks/systems. By messaging with Aspect you consent to the foregoing.  Aspect Capital 
Limited is authorised and regulated by the Financial Services Authority and is a company registered in England and Wales 
under registered no. 3491169. Its registered office is at Nations House, 103 Wigmore Street, London W1U 1QS. ASPECT, 
ASPECT CAPITAL, the ASPECT CAPITAL device and ASPECT CAPITAL:THE SCIENCE OF INVESTMENT are registered trademarks of 
Aspect Capital Limited. © Aspect Capital Limited 2012. All rights reserved. For more information, go to www.aspectcapital.com.

RE: How can I recursively build -SNAPSHOT dependencies present in the filesystem but outside the reactor?

Posted by Chris Beach <Ch...@aspectcapital.com>.
Thanks Thorsten and Ron,

Some additional background:

We're a team of about 25 developers, and 100 projects/modules. All developers are familiar with the whole suite of apps, and move freely between projects. They want to be able to work on several projects locally without taking in unwanted -SNAPSHOT changes from our repo (Artifactory).

In our case, developers simply want to build apps together (usually two or three together depending on the scope of the development task) to ensure the build accurately reflects the code checked out in the developer's workspace. 

We have Jenkins, which builds our projects on SCM commit, and builds dependents. This isn't applicable for individual developer workspace builds.

Ron - the burden of checking out the whole workspace isn't a big deal for us, and we still "peg" individual dependencies to release versions as necessary. My original question concerned workspace builds where we intend to use limited number of -SNAPSHOT dependencies to trigger a  selectively-recursive build across multiple projects.

I am currently building a plugin "maven-r-plugin" which internally uses Maven.execute(MavenExecutionResult) and a file-based index of in-house artifacts to prototype a solution to this problem. Suggestions of better solutions would be welcome.

Thanks,

Chris

This email and any attachments contain CONFIDENTIAL information which may be legally privileged. If this 
communication constitutes a financial promotion, it is directed only at persons who are professional clients or 
eligible counterparties (as defined under the FSA rules).  The information, which is provided on a non-reliance 
basis, may be subject to verification or amendment.  No representation or warranty is made as to its accuracy or 
completeness. Unless expressly stated otherwise, this email is neither an offer to sell nor a solicitation of any 
offer to buy an interest in any fund or other investment vehicle sponsored or managed by Aspect Capital Limited 
(Aspect Funds). Any such offer or solicitation would be made only by way of the final offering documents of such 
Aspect Fund (which should be considered carefully before any investment decision is made) and only in such 
jurisdictions where, and to such persons to whom, it would be lawful to do so. Past performance is not necessarily 
indicative of future returns. Email transmission cannot be guaranteed to be secure or error free.  Subject to 
applicable law, Aspect (or its service providers) may intercept, monitor, review and retain e-communications 
travelling through its networks/systems. By messaging with Aspect you consent to the foregoing.  Aspect Capital 
Limited is authorised and regulated by the Financial Services Authority and is a company registered in England and Wales 
under registered no. 3491169. Its registered office is at Nations House, 103 Wigmore Street, London W1U 1QS. ASPECT, 
ASPECT CAPITAL, the ASPECT CAPITAL device and ASPECT CAPITAL:THE SCIENCE OF INVESTMENT are registered trademarks of 
Aspect Capital Limited. © Aspect Capital Limited 2012. All rights reserved. For more information, go to www.aspectcapital.com.

Re: How can I recursively build -SNAPSHOT dependencies present in the filesystem but outside the reactor?

Posted by Patrick <kc...@gmail.com>.
On Jun 15, 2012, at 7:58 AM, Thorsten Heit wrote:

> Hi Chris,
> 
>> Is there a neat way I could get Maven to perform a recursive build 
>> that looks on the filesystem to find -SNAPSHOT dependency projects 
>> and builds them?
>> I'm familiar with Maven plugin development, but haven't yet found 
>> any clues toward a solution in the Maven / Aether documentation.
> 
> I'd suggest you use a CI system such as Jenkins for that purpose:
> 
> Jenkins parses the pom.xml files on Maven projects and automatically 
> detects dependencies between jobs. If you start a certain job, Jenkins 
> automatically triggers builds on all dependent subjobs, quite similar to 
> what you want to achieve.

I believe that there's a checkbox in the project's config you have to check for this (auto-rebuilding if a dependency changes) to happen.  You'll also want to turn on the option that blocks building the user of the dependencies while the dependencies are being built.


Honestly.  I'm the only person working on the projects I was talking about, but I love using Jenkins.  It means that after I commit, I find out within 10 minutes if the commit I made actually works.  Often I find I forgot a file, or else I find a test only worked on the computer I wrote it on due to assumptions.

I figure it'll take between 1-2 hours to setup if you have no experience, and if so, it'll probably be time well spent.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How can I recursively build -SNAPSHOT dependencies present in the filesystem but outside the reactor?

Posted by Thorsten Heit <th...@vkb.de>.
Hi Chris,

> Is there a neat way I could get Maven to perform a recursive build 
> that looks on the filesystem to find -SNAPSHOT dependency projects 
> and builds them?
> I'm familiar with Maven plugin development, but haven't yet found 
> any clues toward a solution in the Maven / Aether documentation.

I'd suggest you use a CI system such as Jenkins for that purpose:

Jenkins parses the pom.xml files on Maven projects and automatically 
detects dependencies between jobs. If you start a certain job, Jenkins 
automatically triggers builds on all dependent subjobs, quite similar to 
what you want to achieve.

I'd recommend to install the Upstream Downstream Column Plugin that adds 
two quite useful columns to Jenkins' job list: one that lists all "parent" 
jobs, and another with all subjobs as far as Jenkins has detected them.


HTH

Thorsten

Re: How can I recursively build -SNAPSHOT dependencies present in the filesystem but outside the reactor?

Posted by Ron Wheeler <rw...@artifact-software.com>.
On 15/06/2012 4:43 AM, Chris Beach wrote:
> I have two projects as follows, in neighbouring directories on the filesystem:
>
> * project_a (-SNAPSHOT)
> * project_b (-SNAPSHOT, depends on project_a)
>
> I'd like to build project_b and for Maven to discover that project_a exists on the filesystem and thus build it rather than look in the local repo for its artifact.
Why.?
This means that:
- you are stuck as a 1 man shop,
- you need to keep all of your projects active at once
- you will have trouble figuring out what is finished.

The "Best Practice" is to:
- have a Maven repo - Nexus or another, where Maven looks for its artifacts,
- have a SCM - Subversion or some other, where you keep source code with 
proper source version control
- have an IDE - Eclipse STS or some other, where you checkout code from 
your SCM, produce artifacts that are tested and then deployed to your 
repo, checkin your code to your SCM and ,if you are finished with that 
module, deleted from your IDE or at least closed.
- declare your dependencies in your POMs and if you need aggregation 
POMs to group utilities or core functions, do that. This is a one-time 
investment in productivity enhancement that makes life better.

We have roughly 70 modules making webapps, web services and batch jobs 
and 10 libraries that group third party and internal utilities for us.
We use Eclipse STS, Maven, Subversion and Nexus and the environment is 
very easy to use, well organized and controlled.

If you don't want to do it "right", Eclipse STS will allow you to 
resolve Maven artifacts from your workspace and do roughly what you seem 
to want.

Ron

>
> I could build these within an aggregator and use the reactor to select project_b i.e.
>
> mvn --projects project_b [goal]
>
> However, this is problematic because
>
> * this two-project example is a simplification of my real build, which consists of dozens of projects, and I don't want to have to maintain an aggregator project that lists all of them.
> * I only want to recursively build -SNAPSHOT dependencies
>
> Is there a neat way I could get Maven to perform a recursive build that looks on the filesystem to find -SNAPSHOT dependency projects and builds them?
> I'm familiar with Maven plugin development, but haven't yet found any clues toward a solution in the Maven / Aether documentation.
>
> Chris Beach
>
> This email and any attachments contain CONFIDENTIAL information which may be legally privileged. If this
> communication constitutes a financial promotion, it is directed only at persons who are professional clients or
> eligible counterparties (as defined under the FSA rules).  The information, which is provided on a non-reliance
> basis, may be subject to verification or amendment.  No representation or warranty is made as to its accuracy or
> completeness. Unless expressly stated otherwise, this email is neither an offer to sell nor a solicitation of any
> offer to buy an interest in any fund or other investment vehicle sponsored or managed by Aspect Capital Limited
> (Aspect Funds). Any such offer or solicitation would be made only by way of the final offering documents of such
> Aspect Fund (which should be considered carefully before any investment decision is made) and only in such
> jurisdictions where, and to such persons to whom, it would be lawful to do so. Past performance is not necessarily
> indicative of future returns. Email transmission cannot be guaranteed to be secure or error free.  Subject to
> applicable law, Aspect (or its service providers) may intercept, monitor, review and retain e-communications
> travelling through its networks/systems. By messaging with Aspect you consent to the foregoing.  Aspect Capital
> Limited is authorised and regulated by the Financial Services Authority and is a company registered in England and Wales
> under registered no. 3491169. Its registered office is at Nations House, 103 Wigmore Street, London W1U 1QS. ASPECT,
> ASPECT CAPITAL, the ASPECT CAPITAL device and ASPECT CAPITAL:THE SCIENCE OF INVESTMENT are registered trademarks of
> Aspect Capital Limited. © Aspect Capital Limited 2012. All rights reserved. For more information, go to www.aspectcapital.com.


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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