FAQ
I have an interesting use case to pick everyone's brain on…

A developer came to my desk and said "We want to allow other teams to put a dependency on our tests jar for their test scope, but don't want to allow them access to the non-tests jars in our project."

At first I said "No problem. I can easily do that with patterns in Nexus." And then I started thinking deep thoughts…

The tests jar has its pom defined as the same pom which was used for the main jar, and so all the transitive dependencies will come from that pom when you reference the tests jar.

I can hear many of you thinking "Well yeah. That’s what dependency exclusions are for." However, it can be much more complicated than that. As far as I know, you cannot exclude a groupId/artifactId combination and then include the same groupId/artifactId with a classifier (in this case "tests") being named. (please correct me if that is false)

Also, since I am writing this anyhow… Will the declaration of a dependency on the tests jar cause a transitive inclusion of the regular jar? My gut Maven knowledge tells me "no" but I want to make sure of this before I start shooting myself in the foot.



Thanks,

Roy Lyons

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

Search Discussions

  • Ron Wheeler at Sep 28, 2012 at 8:30 pm

    On 28/09/2012 3:53 PM, Lyons, Roy wrote:
    I have an interesting use case to pick everyone's brain on…

    A developer came to my desk and said "We want to allow other teams to put a dependency on our tests jar for their test scope, but don't want to allow
    them access to the non-tests jars in our project."
    Make your useful test classes into a separate project that produces a
    jar "com.mycopany.project.test:test-utility:1.0" and make it a
    dependency for both projects.
    No law against making small special purpose artifacts if they are useful
    even if it is only in the testing process.

    Much easier than trying to do what you describe in the following section.
    At first I said "No problem. I can easily do that with patterns in Nexus." And then I started thinking deep thoughts…

    The tests jar has its pom defined as the same pom which was used for the main jar, and so all the transitive dependencies will come from that pom when you reference the tests jar.

    I can hear many of you thinking "Well yeah. That’s what dependency exclusions are for." However, it can be much more complicated than that. As far as I know, you cannot exclude a groupId/artifactId combination and then include the same groupId/artifactId with a classifier (in this case "tests") being named. (please correct me if that is false)

    Also, since I am writing this anyhow… Will the declaration of a dependency on the tests jar cause a transitive inclusion of the regular jar? My gut Maven knowledge tells me "no" but I want to make sure of this before I start shooting myself in the foot.



    Thanks,

    Roy Lyons

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

    --
    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriesmaven
postedSep 28, '12 at 7:53p
activeSep 28, '12 at 8:30p
posts2
users2
websitemaven.apache.org
irc#maven

2 users in discussion

Lyons, Roy: 1 post Ron Wheeler: 1 post

People

Translate

site design / logo © 2021 Grokbase