Hello everyone,

I see that, by including a pom in compile scope, the project has the
dependencies defined as transitive dependencies in it's classpath.
Two things come to my mind, which could make a scope include sensible:
1) dependency:analyze AKA define what you depend on for compilation
- we use dependency:analyze and have a policy that projects should
depend directly on stuff they need for compilation.
- I have not checked this but by "(ab)using" a pom with compile scope,
dependencies defined in there will trigger warnings from
dependency:analyze, do they not?
2) using dependencies for other scopes
- I think only dependencies declared in compile scope will be
transitively in compile of the including project.
- What if you always want to include junit, hamcrest and mockito
(easymock ...) in scope test?

Regards Mirko

On Tue, Feb 5, 2013 at 4:29 PM, Laird Nelson <ljnel...@gmail.com> wrote:
> On Tue, Feb 5, 2013 at 6:10 AM, Matthew Adams <matt...@matthewadams.me>wrote:
>
>> What I was looking
>> for was a way to define a new artifact in a pom that, if used in a
>> consuming artifact's <dependencies>, would include all of the dependencies
>> in the referenced artifact.
>
>
> Hello; you can do this today by simply declaring a "normal" dependency on
> an artifact of type pom.
>
> So:
>
> <dependency>
>   <groupId>your.datanucleus.pom.groupId</groupId>
>   <artifactId>your.datanucleus.pom.artifactId</artifactId>
>   <version>whatever</version>
>   <scope>compile</scope>
>   <type>pom</type>
> </dependency>
>
>
> You should not feel like you missed something; this is not really explained
> well anywhere.  You kind of have to infer it from other parts of the Maven
> documentation.
>
> There are several side effects to doing things this way, which may or may
> not matter to you.
>
> First, the dependencies are "one level down"--that is, you didn't include
> your pom artifact's dependencies directly, you included them transitively.
>  This might have a bearing on what versions of a given dependency "win" in
> a complex inherited pom scenario.
>
> Second, I'm just frankly not sure how (or if) the
> dependencyManagementsection in the pom-as-dependency will work, if at
> all.
>
> I hope this helps.
>
> Best,
> Laird
>
> --
> http://about.me/lairdnelson

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

Reply via email to