Explicitly:

"bom" file:

1 - has dependencies I'd like to use everywhere - no scope attached here
to any of them.

"consumer" file:

1 - has dependencyManagement listing the bom pom with a scope of
"import"
2 - has a <dependency> on the bom project with <type>pom</type> and
<scope>provided</scope>

Doing things this way, the "consumer" project sees all the dependencies
listed in the "bom" project just fine.

I'm not thrilled about having to put what scope I'd like the bom
dependencies to use in the consumer file (we may want some to be
provided and some to be compile and some to be runtime).  But, I think
there are (in this case) one or two types of scenarios which can be
managed by one or two "bom" type projects.

What hung me up was intitially, the "bom" had these dependencies listed
as provided.  Anytime I'm using transitive dependencies and the provided
scope, I forget there is some funky handling and wind up getting things
pretty wrapped around the axle.  "mvn dependency:tree" showed me what
was going on and I could see what scope I'd like and adjusted it from
the consumer pom.  Everything is working fine, this reply is for those
searching on the import scope usage in the future :-)

-----Original Message-----
From: Wayne Fay [mailto:[email protected]] 
Sent: Saturday, January 31, 2009 4:26 AM
To: Maven Users List
Subject: Re: <scope>import</scope>

> I've set up a "bom" file that lists a set of dependencies that 
> multiple projects use.
>
> In a "consumer" project, I've set up a dependencyManagement stanza 
> listing this bom as a dependency/type = pom/scope = import.
>
> Now, in this same "comsumer" project, maven doesn't see those 
> dependencies.  I've even tried listing the dependencies that exist in 
> the "bom" in the "consumer" project (minus version info) and it still 
> fails.

As far as I understand it, the import scope was only designed to import
dependencyManagement. Thus, it will not actually ADD any dependencies to
your project, merely help you manage versions etc by adding those in
dependencyManagement from the imported POM to the dependencyManagement
section of your current POM. It won't import from any sections in your
pom other than dependencyManagement, so dependencies themselves are
ignored.

So, it sounds like your experiences mostly match what I would expect.
I'm not using import scope yet myself for anything serious, so I can't
really tell you about personal experiences, only what I've read and seen
thus far myself.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to