should see dependency when scope is 'compile' http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
Cheers (from across the pond) Martin Gainty GMT+5 ______________________________________________ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > Subject: RE: Multiple project dependencies > Date: Thu, 6 Nov 2008 09:06:45 +0000 > From: [EMAIL PROTECTED] > To: users@maven.apache.org > > Hi Rafael, > > Thanks for your response. > > My question surrounds dependencies, and while I understand how to > declare a dependency, what I want to know is how I make maven recompile > dependencies. > > So if A depends on B, and I run 'mvn jar' in project B, how can I make > it recompile (and I guess, run 'mvn install') in A? My scenerio is that > I will be making changes to both A and B, but both are separate projects > and I don't want to have to run 'mvn install' in A before doing anything > with project B. Obviously, if A depends on B, A will not compile if B > has been modified in some way given A fetches A.jar from the repository. > > Neither A or B share a common parent. In fact, they could easily have > different parents. > > Thanks, > > > John > > > -----Original Message----- > > From: Rafael Trestini [mailto:[EMAIL PROTECTED] > > Sent: 04 November 2008 18:32 > > To: Maven Users List > > Subject: Re: Multiple project dependencies > > > > John, > > > > In this case, your parent pom (1st level pom.xml) will > > inherit from > > com.atlassian.concluence.plugin.base:confluence-plugin-base:17 > > , and each module will inherit your parent pom. Example: > > /yourproject > > pom.xml (your parent pom - inherits confluence plugin) > > /module-a > > pom.xml (your module-a pom - inherits parent pom) > > /module-b > > pom.xml (your module-b pom - inherits parent pom) > > > > Using the structure from example, your parent pom would use > > the following module declaration: > > <modules> > > <module>module-a</module> > > <module>module-b</module> > > </modules> > > > > In this approach, maven will search for a subdirectory named > > "module-a" and other named "module-b", each one containing a pom.xml. > > > > Remembering: there's a significant difference between > > inheritance and dependency. If you need to *use*, for > > example, X.jar that contains shared and/or common code, the > > relation between this jar and your project is a dependency, > > and not a inheritance, because X.jar is not _part-of_ your > > project. However, if you have a module inside your project > > with common code that concerns exclusively to the project, > > this module is _part-of_ and is shared with other modules > > inside your project. > > > > Hope it helps. > > > > Rafael Trestini > > > > On Tue, Nov 4, 2008 at 6:08 AM, > > <[EMAIL PROTECTED]> wrote: > > > > > > Graham, > > > > > > Thanks for your advice. I was wondering if parent/child > > relationships > > > were the answer. However, there are two problems with this > > approach. > > > > > > The first is that I'm writing a plugin to a product and it > > created the > > > maven project, and I note it's declared a parent: > > > > > > <parent> > > > <groupId>com.atlassian.confluence.plugin.base</groupId> > > > <artifactId>confluence-plugin-base</artifactId> > > > <version>17</version> > > > </parent> > > > > > > So, my plugin already depends on the Confluence Plugin base, and > > > depends on my common code pom. How is this structured? > > > > > > The second is that I'm still somewhat unfamilar with the directory > > > structure for the parent/child relationships. If I had poarent > > > project and two child projects, how does the <parent> tag > > of the child > > > project know where to find the parent project (on the filesystem). > > > > > > Thanks, > > > > > > > > > John > > > > > > > -----Original Message----- > > > > From: Graham Leggett [mailto:[EMAIL PROTECTED] > > > > Sent: 03 November 2008 21:00 > > > > To: Maven Users List > > > > Subject: Re: Multiple project dependencies > > > > > > > > [EMAIL PROTECTED] wrote: > > > > > > > > >> I'm new to maven and I have a question regarding multiple > > > > >> projects and how the can be linked. I've created a > > "common code" > > > > project, and > > > > >> I have another which depends upon this project. I've got two > > > > >> directories, two pom files, etc., and the common code > > project can > > > > >> generate a jar file (mvn jar:jar). The other project has a > > > > >> dependency in the pom.xml file: > > > > >> > > > > >> <dependency> > > > > >> <groupId>com.x.common</groupId> > > > > >> <artifactId>x.common</artifactId> > > > > >> <version>0.0.1-SNAPSHOT</version> > > > > >> </dependency> > > > > >> > > > > >> When the mvn process runs, it contacts the repositories > > > > and tries to > > > > >> download this dependency, which will obviously fail. How do I > > > > >> configure mvn to look locally for a dependency, and in > > > > this case, run > > > > >> mvn jar:jar in the common project directory to obtain the > > > > >> required jar? > > > > > > > > It depends on how you want to structure your code. > > > > > > > > If the common code is likely to follow it's own release > > cycle, make > > > > a formal release of the common code, and then make your > > code depend > > > > on that formal release. Don't do this manually, use the release > > > > plugin to do this for you. > > > > > > > > If the common code is likely to change alongside the > > other code, you > > > > might choose to build and release all the jars together in one go. > > > > > > > > What you want to do is create a multi-module project by > > creating a > > > > parent pom project, and add each of the multi modules as > > children of > > > > this parent, using the <module> element in the pom. In each child > > > > project, add the <parent> tag pointing back to the parent pom. > > > > > > > > When you build the parent, all the modules listed within > > the parent > > > > will be built. > > > > > > > > If your dependencies are configured correctly, maven will > > figure out > > > > for itself what order things should be built in. > > > > > > > > Hint: in your children projects, make them inherit the parent's > > > > version by putting in ${pom.version} as a variable. > > > > For example: > > > > > > > > <dependency> > > > > <groupId>com.x.common</groupId> > > > > <artifactId>x.common</artifactId> > > > > <version>${pom.version}</version> > > > > </dependency> > > > > > > > > When you release the parent, the children will be released and > > > > versioned automatically. > > > > > > > > Regards, > > > > Graham > > > > -- > > > > > > > _______________________________________________ > > > > > > This e-mail may contain information that is confidential, > > privileged or otherwise protected from disclosure. If you are > > not an intended recipient of this e-mail, do not duplicate or > > redistribute it by any means. Please delete it and any > > attachments and notify the sender that you have received it > > in error. Unless specifically indicated, this e-mail is not > > an offer to buy or sell or a solicitation to buy or sell any > > securities, investment products or other financial product or > > service, an official confirmation of any transaction, or an > > official statement of Barclays. Any views or opinions > > presented are solely those of the author and do not > > necessarily represent those of Barclays. This e-mail is > > subject to terms available at the following link: > > www.barcap.com/emaildisclaimer. By messaging with Barclays > > you consent to the foregoing. Barclays Capital is the > > investment banking division of Barclays Bank PLC, a company > > registered in England (number 1026167) with its registered > > office at 1 Churchill Place, London, E14 5HP. This email may > > relate to or be sent from other members of the Barclays Group. > > > _______________________________________________ > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > -- > > Responsibility is the price of freedom > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > _______________________________________________ > > This e-mail may contain information that is confidential, privileged or > otherwise protected from disclosure. If you are not an intended recipient of > this e-mail, do not duplicate or redistribute it by any means. Please delete > it and any attachments and notify the sender that you have received it in > error. Unless specifically indicated, this e-mail is not an offer to buy or > sell or a solicitation to buy or sell any securities, investment products or > other financial product or service, an official confirmation of any > transaction, or an official statement of Barclays. Any views or opinions > presented are solely those of the author and do not necessarily represent > those of Barclays. This e-mail is subject to terms available at the following > link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent > to the foregoing. Barclays Capital is the investment banking division of > Barclays Bank PLC, a company registered in England (number 1026167) with its > registered office at 1 Churchill Place, London, E14 5HP. This email may > relate to or be sent from other members of the Barclays Group. > _______________________________________________ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > _________________________________________________________________ Color coding for safety: Windows Live Hotmail alerts you to suspicious email. http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_safety_112008