users@jersey.java.net

[Jersey] Repackaging Jersey 1.x jars without jax-rs

From: Ian Simpson <ian.g.simpson_at_gmail.com>
Date: Mon, 17 Jun 2013 11:26:32 -0600

I'm looking at using Jersey 2.0 and I'm trying to tackle the issue of
having both the 1.x and 2.x jax-rs classes within the same classpath.

The jersey-core Maven dependencies for 1.x all bundle the jax-rs classes
inside, which is undesirable from a class loading standpoint when using
Jersey 2.x since you need jax-rs 2.0. There's an excellent blog post
outlining this concern here:
http://sleeplessinslc.blogspot.com/2012/10/jax-rs-20-jersey-20-preview-example.html

JUnit has a similar issue with including hamcrest, which creates issues if
you use Maven to block duplicate classes. There's also a junit-dep jar
that's available which doesn't include this package.

Can a similar thing be done retroactively and deployed to Maven central for
the Jersey 1.x jars? Perhaps create a jersey-core-nodeps or something
along those lines? I could repackage the jars myself and upload them to my
organization's internal Nexus instance, but it would be preferable to have
them available via Central.

I'm also open to the fact that I may be missing the obvious solution or an
easy alternative. If that's the case please call out my obliviousness.