users@jersey.java.net

[Jersey] Re: Problem with Maven and jersey-test-*

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Thu, 24 Feb 2011 16:07:48 +0100

On 02/23/2011 03:36 PM, Casper Bang wrote:
>
> this is weird.. see
> http://download.java.net/maven/glassfish/org/glassfish/javax.servlet/3.0-b66/
>
> are you sure that you are not somehow excluding/ignoring glassfish
> maven repo? You might want try to add it to your pom file:
>
> <repository>
> <id>glassfish.dev.java.net <http://glassfish.dev.java.net></id>
> <url>http://download.java.net/maven/glassfish</url>
> <layout>default</layout>
> </repository>
>
> it could help..
>
>
> It did! Thanks, I have no idea where in the Maven chain there's a weak
> link (I suspect ehcache-web and my explicit terracotta-repository) but
> this fixed it.
>
> You don't need json dependencies, they are already introduced by
> jersey-json module.
>
>
> Indeed, thanks!
>
> Same applies to javax.servlet (introduced by jersey-server).
>
>
> Well except, I inject javax.servlet.ServletContext into many of my
> resources and this type can not be resolved without an explicit
> dependency of javax.servlet.servlet-api. But this seems remotely
> connected to my previous problem (resolving org.glassfish.*). I
> noticed jersey-server pulls in what looks like a glassfish specific
> variation of the servlet specification:
>
> <dependency>
> <groupId>org.glassfish</groupId>
> <artifactId>javax.servlet</artifactId>
> <version>3.0</version>
> <scope>provided</scope>
> </dependency>
>
> I am not sure I understand this, considering what the EE specification
> [http://download.oracle.com/javaee/6/api/javax/servlet/package-summary.html]. Why
> this apparent duality/inconsistency? Has one superseded/deprecated the
> other or is it an API/SPI hybrid thing?
no, it is just an api jar and neither is deprecated. Problem is, that
sun/oracle api jars are not present in central repo ([1]) and "everyone"
is workarounding it somehow. For example, every appserver has its own
artifact with this api. From my side, only official javax.servlet api
artifact is this one (org.glassfish:javax.servlet). But it doesn't
really matters which one you use - as long as you use same version. And
I guess that in some time, 3.0 will be present in central repo as well
so users won't need to add other repository to their poms..

Pavel


[1] http://maven.apache.org/guides/mini/guide-coping-with-sun-jars.html

>
> I might be able to help you better if you can share that project
> and way how you are executing your tests. You can send it directly
> to me if you don't want/can't share it publicly.
>
>
> That's very kind, but thanks to your help my tests now run again. I
> think it was that pesky inability to resolve org.glassfish.* in
> the maven dependency chain that caused most of my trouble.
>
> Kind regards,
> Casper