users@jersey.java.net

Re: [Jersey] maven mixes jars?

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Thu, 10 Dec 2009 21:56:09 +0100

On Thu, Dec 10, 2009 at 09:44:37AM -0700, Roger Pack wrote:
> Situation.
>
> Within a maven module, I have a dependency on an artifact that
> [through its children dependencies] relies on jersey-1.0.2

Do you have a dependency on an artifact, let say X, which depends
on jersey 1.0.2? And besides that you have an explicit dependency on jersey-... 1.1.4.1

If so, you could try to get rid of that dependency like follows:

        <dependency>
            <groupId>${X.group}</groupId>
            <artifactId>X</artifactId>
            <version>${X.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-client</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jersey</groupId>
                    <artifactId>jersey-core</artifactId>
                </exclusion>
                ...
             </exclusions>
        </dependency>

But given that you mixing jersey versions, it is still not guaranteed the above
would work for you.

~Jakub


>
> I then add a dependency to jersey-test-framework 1.1.4
>
> When I run my tests, I get java.lang.NoClassDefFoundError:
> com/sun/jersey/core/util/FeaturesAndProperties
>
> Looking at the jars maven actually ends up using, it appears to be using
> jersey-test-framework 1.1.4
> jersey-server 1.1.4
> jersey-client 1.0.2
> jersey-core 1.0.2
>
> where the FeaturesAndProperties class is found in jersey-core 1.1.4 [not 1.0.2].
>
> If I add an explicit dependency on jersey-client 1.1.4, jersey-core
> 1.1.4 is also used.
>
> Anybody know if this is expected/what is going on here? Shouldn't it
> choose the highest version required, by default?
> Thanks.
> -r
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
http://blogs.sun.com/japod