Skip to content
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

[jsr-353] Add apache karaf features to jackson #1

Closed
steinarb opened this issue Sep 11, 2019 · 16 comments
Closed

[jsr-353] Add apache karaf features to jackson #1

steinarb opened this issue Sep 11, 2019 · 16 comments

Comments

@steinarb
Copy link

This is the part of FasterXML/jackson-databind#2434 that relates to changes to the jackson-datatype-jsr353 project.

steinarb referenced this issue in steinarb/jackson-datatype-jsr353 Sep 18, 2019
steinarb referenced this issue in steinarb/jackson-datatype-jsr353 Oct 18, 2019
@cowtowncoder cowtowncoder changed the title Add apache karaf features to jackson [jsr-353] Add apache karaf features to jackson Jun 2, 2020
@cowtowncoder cowtowncoder transferred this issue from FasterXML/jackson-datatype-jsr353 Jun 2, 2020
@cowtowncoder
Copy link
Member

Would be eligible for Hacktoberfest swag for sure.

@steinarb
Copy link
Author

steinarb commented Oct 3, 2020

@cowtowncoder If so, what version of jackson should be targeted? And what's the timeline? I.e. when do something participating in Hacktoberfest need to be ready?

@cowtowncoder
Copy link
Member

cowtowncoder commented Oct 4, 2020

@steinarb Hacktoberfest is for October 2020; does not actually have to be merged during it, I think I can just add a label to indicate acceptance (merging would indicate acceptance too).
I need to follow up on this https://hacktoberfest.digitalocean.com/hacktoberfest-update to make sure I do the necessary things.

Depending on timeline: right now, 2.12 is still possible (rc1 to be released Really Soon Now, but final 2.12.0 at least 4 weeks out I think). If not, once I create 2.13 branch, that.
If changes are minor enough could even go in 2.12 patch release, I forget if there was something invasive needed or not.

@steinarb
Copy link
Author

steinarb commented Oct 4, 2020 via email

@cowtowncoder
Copy link
Member

@steinarb is that specifically just for this repo (wrt dependency to jsr-353 impl) or... ? For such cases, definitely for 2.12 then and not patch. But I guess it really depends on which dependencies would become provided.

@steinarb
Copy link
Author

steinarb commented Oct 5, 2020

@cowtowncoder The change to maven provided was in several repos, and also in the core repos (I think) which has build effects for more or less all projects.

I have all of the changes in my notes somewhere, but not handy right now.

(The build fix for a build that breaks because of this change, is to explicitly add all maven dependencies that are needed. So the fix is straightforward)

@cowtowncoder
Copy link
Member

@steinarb Ok I am just trying to understand need for "provided" dependencies since that's different from some of other transitive dependencies (compile-time, mostly).

@steinarb
Copy link
Author

steinarb commented Oct 5, 2020

@cowtowncoder To the maven-bundle-plugin provided means "add an import-package in the manifest.mf rather than pulling in the packages into the bundle"

To the karaf-maven-plugin provided means: "do not add this dependency as a bundle that should be started by the feature". Instead a feature dependency is added for a feature that will start the bundle.

Karaf features is a higher level dependency mechanism that figures out what needs to be loaded (and more importantly what does not need to be loaded) and avoids starting bundles multiple times (instead already started bundles are shared).

It is possible to work around not changing but that would require a lot of maven configuration, that is fragile wrt. to code changes.

The short story is that when working with OSGi and maven it is best to have dependencies as provided.

However having dependencies as provided has the effect that maven won't use transitive dependencies when compiling.

That's where the "changes to builds" comes in: builds that currently rely on transitive dependencies will start failing when scope is changed. The fix will be fairly trivial: add the missing dependencies as direct dependencies.

But people whose build break may be annoyed.

@cowtowncoder
Copy link
Member

Hmmh ok. I feel I am still missing something... so just make sure:

  • When we talk about "provided", are we still talking about Maven dependency type, in pom.xml or something else? Terms are pretty overloaded and provided scope is not used a lot in Jackson
  • Is there any value in starting by provided Karaf features starting from the bottom? Or is the main value in the other end -- at the top where there are more dependencies?

To take a concrete example: jackson-databind has only 2 compile-time dependencies, currently: jackson-annotations and jackson-core.
Would scope of these need to change in pom.xml?

@steinarb
Copy link
Author

steinarb commented Oct 5, 2020

The answer to the first question is: Yes. with "provided" we are talking about the scope of maven dependencies.

The answer to the second question, is: Yes, there is value in starting at the bottom and creating features for the core features.

However, the core features are where the scope of maven dependencies have to be modified. I.e. that's where the change to maven builds occur. And once the core dependencies are in place creating other features on top of them are easy.

@steinarb
Copy link
Author

steinarb commented Oct 5, 2020

(FWIW just adding the features for the jackson core will have value for me personally, because those are the features I need for a feature for loading jersey)

@steinarb
Copy link
Author

steinarb commented Oct 6, 2020

@cowtowncoder I was too tired to see the last question: what projects are effected?

I have a list somewhere of the affected projects. I will dig it up this afternoon (European time), and post it here.

@steinarb
Copy link
Author

steinarb commented Oct 6, 2020

@cowtowncoder These are the maven dependency changes:

  1. jackson-databind:
    1. made the jackson-core dependency provided
    2. made the jackson-annotations dependency provided
  2. jackson-modules-base
    1. afterburner
      1. Made the jackson-core dependency provided
      2. Made the jackson-databind dependency provided
    2. guice
      1. Made the jackson-annotation dependency provided
      2. Made the jackson-core dependency provided
      3. Made the jackson-databind dependency provided
      4. Exclude javax.inject to avoid a conflicting javax.inject with jackson-module-paranamer
    3. jaxb
      1. Made the jackson-annotation dependency provided
      2. Made the jackson-core dependency provided
        3, Made the jackson-databind dependency provided
    4. mrbean
      1. Made the jackson-core dependency provided
      2. Made the jackson-databind dependency provided
      3. Made the jackson-annotation dependency provided
    5. osgi
      1. Made the jackson-databind dependency provided
    6. paranamer
      1. Made the jackson-databind dependency provided
  3. jackson-dataformats-binary
    1. avro
      1. Made the jackson-annotations dependency provided
      2. Make the jackson-databind maven dependency provided
  4. jackson-dataformat-xml
    1. Made the jackson-annotation dependency provided
    2. Made the jackson-core dependency provided
    3. Made the jackson-databind dependency provided
  5. jackson-datatype-hibernate
    1. Made the jackson-core dependency provided
    2. Made the jackson-databind dependency provided
    3. hibernate3
      1. Change the scope of the hibernate-core maven dependency from provided to compile
    4. hibernate5
      1. Change the scope of the hibernate-core maven dependency from provided to compile
  6. jackson-dataformats-text
    1. csv
      1. Made the jackson-annotations dependency provided
      2. Make the jackson-databind maven dependency provided
    2. yaml
      1. Made the jackson-annotations dependency provided
      2. Make the jackson-core maven dependency provided
      3. Make the jackson-databind maven dependency provided
  7. jackson-datatype-json-org
    1. Made the jackson-core dependency provided
    2. Made the jackson-databind dependency provided
  8. jackson-datatype-jsr353
    1. Made the jackson-core dependency provided
    2. Made the jackson-databind dependency provided
  9. jackson-jaxrs-providers
    1. base
      1. added jackson-core as a provided dependency
      2. added jackson-databind as a provided dependency
    2. datatypes
      1. added jackson-core as a provided dependency
      2. added jackson-databind as a provided dependency
    3. cbor
      1. added jackson-core as a provided dependency
      2. added jackson-databind as a provided dependency
      3. made jackson-dataformat-cbor be provided
      4. made jackson-module-jaxb-annotations be provided
      5. made jackson-jaxrs-base be provided
    4. json
      1. added jackson-core as a provided dependency
      2. added jackson-databind as a provided dependency
      3. made jackson-dataformat-cbor be provided
      4. made jackson-module-jaxb-annotations be provided
      5. made jackson-jaxrs-base be provided
    5. smile
      1. added jackson-core as a provided dependency
      2. added jackson-databind as a provided dependency
      3. made jackson-jaxrs-base be provided
      4. made jackson-dataformat-smile be provided
      5. made jackson-module-jaxb-annotations be provided
    6. xml
      1. added jackson-core as a provided dependency
      2. added jackson-databind as a provided dependency
      3. made jackson-dataformat-xml be provided
      4. made jackson-module-jaxb-annotations be provided
      5. made jackson-jaxrs-base be provided
      6. made stax2-api be provided
      7. made woodstox-core be provided
    7. yaml
      1. added jackson-core as a provided dependency
      2. added jackson-databind as a provided dependency
      3. made jackson-dataformat-yamls be provided
      4. made jackson-module-jaxb-annotations be provided
      5. made jackson-jaxrs-base be provided
  10. jackson-jr
    1. jr-objects
      1. Made the jackson-core dependency provided
    2. jr-retrofit2
      1. Made the jackson-core dependency provided
    3. jr-stree
      1. Made the jackson-core dependency provided
  11. jackson-module-jsonSchema
    1. Made the jackson-annotations dependency provided
    2. Made the jackson-core dependency provided
    3. Made the jackson-databind dependency provided
  12. jackson-module-kotlin
    1. add jackson-core as a provided dependency
    2. add jackson-module-jaxb-annotations as a test scoped dependency

@cowtowncoder
Copy link
Member

Ok, unfortunately, if "provided" is scope for Maven build, I don't think I will want to proceed with this.
Apologies for it taking this long before I understood that part.

@steinarb
Copy link
Author

steinarb commented Oct 7, 2020

I'm sorry to hear that. It means a lot of work will be wasted.

And it really was a lot of work.

FWIW I think the maven build is more consistent and predictable after the change. Before some dependencies had scope provided and some had scope compile (ie. the default when no ). With this change they are provided for a reason,

(but it shouldn't be a candidate for a minor version. It could be a candidate for a major version that will break builds in any case...?)

@cowtowncoder
Copy link
Member

I am sorry that I did not catch this earlier, to indicate that this can not proceed.

I do not think there were many provided dependencies ever, with maybe exception of JAXB classes for JAX-RS provider or such.

But I can not see any reason why transitive dependencies should not be properly brought in so that -- for example -- when user uses API of jackson-databind, jackson-core will be automatically depended on too.
Or, jackson-dataformat-yaml that absolutely requires SnakeYAML -- but handles it as internal dependency, hidden if possible from users (*) -- and it would be essentially wrong for users to have to provide it explicitly somehow.

(*) dependency was shaded earlier, but them OSGi users complained that this causes some issues. Go figure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants