-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MessageBodyReader & Writer in META-INF/service issues... #39
Comments
Assumption is that users like the simplicity of simply dropping provider jar, without explicit registration. This is why the default jar contains SPI metadata. One possible way to offer choice here would be to use Maven qualifiers and essentially build 2 variants of jars; ones with SPI registration, and others without it. I don't know how to do it, but think it can be done. |
Nice idea, google did that with guava because of how CDI works in JavaEE 6 and Java EE 7 server (link) I think all you need to do is create two build artifacts one with the usual scheme:
and another with the qualifier
(where the latter is built without the META-INF/services) and then publish them. |
I have a patch ready for JSON provider, going to write a simple test and will submit a pull request. |
@japod Yeah I think classifier is the way to go. My only concern is that I wouldn't want to double number of sub-modules if possible (since we have 3 data formats supported, and will most likely get more over time). But as long as release process is automated, I am open to any solutions. And just to make sure: I do not want to have a single artifact without SPI information without full discussion on mailing list. Problem there would be that a simple upgrade (2.3 -> 2.4) would basically change registration and then users would wonder why their deployments broke. |
My suggestion is simple. Move the provider classes over to jackson-jaxrs-base. Then have jaxrs-providers depend on that and have the META-INF.services entries. For someone like me I will just depend on base and register the provider I want myself. This issue is HUGE and will make many of our lives easier who are using Jersey 2.x |
I don't think that would work, if I understand the idea correctly -- the But if necessary, we can just double up on sub-modules, and create set of The main open question would then be that of naming: would the existing
or
For backwards compatibility first choice would work better via Maven but -+ Tatu +- On Fri, Feb 7, 2014 at 1:25 PM, Robert DiFalco [email protected]:
|
Maybe I don't understand but I think this solution prevents anyone from being impacted. JacksonJsonProvider and JacksonJaxbJsonProvider classes are simply moved over to base. But they are inert and do not impact anyone using the base jar. But the provider jar includes the META-INF.services file so people who have come to expect the auto-registration behavior are ALSO not impacted and continue to have the behavior they had before. But again, I could be missing something. The provider jar already depends on the jaxrs-base jar so that dependency is not changed. But really, any way it is solved is great for me as long as it is solved. Thanks! |
On Fri, Feb 7, 2014 at 2:38 PM, Robert DiFalco [email protected]:
I agree in that if we only had JSON provider, this would be doable. -+ Tatu +- |
Oh yeah, that was myopic of me! Sorry. |
On Fri, Feb 7, 2014 at 2:53 PM, Robert DiFalco [email protected]:
But I think we can make this work with a variation, and that should resolve -+ Tatu +- |
+1 just a quick note that I'm also very much looking forward to a resolution of this: the documentation on the Jersey pages mentions the approach public class MyObjectMapperProvider implements ContextResolver<ObjectMapper> {
...
} and as @pnsantos mentioned, that doesn't work. So I'm guessing everybody who uses Jackson 2.x with Jersey is affected and will stumble over this sooner or later. |
There hasn't been any progress here, alas, much due to plenty of other Jackson work, but I am still looking forward to potential contributions for 2.5, if anyone has time & interest. |
As per PR just merged, second set of jars with classifier of |
If possible I would strongly, strongly recommend not using a qualifier but instead modifying the version number, something to the effect of 2.6.0-no-metainf-services. The issue with using a qualifier is that it changes the maven coordinates, meaning that you could get both jackson-jaxrs-json-provider:2.6.0 and jackson-jaxrs-json-provider:2.6.0:no-metainf-services in your dependency tree. By modifying the version instead of using a qualifier, they will still have the same maven coordinates so you can only end up with one in your dependency tree. This allows users to easily pick which one they want to use and not have to worry about adding exclusions all over the place to prevent the undesirable one from sneaking in as well. |
@jhaber Do you know of a way to automatically release concurrent versions, similar to how qualifier approach works? |
Hi, I've recently ran into a problem trying to use ackson-jaxrs-json-provider 2.3.0 with Jersey 2.4.1. The problem has to do with the automatic scanning that Jersey does of META-INF/services which can't be disabled otherwise CDI stops functioning.
The problem is that if I want to create a custom ContextResolver (to configure some global Jackson options) that context resolver, and consequently the corresponding object mapper is completly ignored unless I remove the META-INF/services folder.
The issue came up a while ago in Jersey's list (see this post). I'm far from an expert but is it absolutely necessary to include these? can (as per the sugestion in the mentioned post) these two files (MessageBodyReader and MessageBodyWriter) be included in a seperate jar?
The text was updated successfully, but these errors were encountered: