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]

Reply via email to