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

Add Jackson Module Kotlin dependency when Kotlin is the selected language #400

Closed
cah-andrew-fitzgerald opened this issue Mar 31, 2017 · 10 comments

Comments

@cah-andrew-fitzgerald
Copy link

Jackson Module Kotlin adds support for serializing/deserializing Data classes and some other built in classes.

It should be included as a dependency when Kotlin is selected if another module which provides jackson is included.

@sdeleuze
Copy link
Contributor

sdeleuze commented Apr 1, 2017

Make sense but I guess the tricky point is to be able to detect when an initializr dependency transitively included Jackson one. @snicoll Do you see a way to achieve that?

@snicoll
Copy link
Contributor

snicoll commented Apr 1, 2017

It does and it is technically feasible but I am not keen to bring that kind of complexity in initializr at this point. We have had similar requests to add java8 specific artifacts before Java8 became an obvious default and we rejected them.

@sdeleuze
Copy link
Contributor

sdeleuze commented Apr 1, 2017

I plan to work on a Spring Boot 2.0 + Kotlin guide, I think I will add that as a documentation item then.

@fitzoh
Copy link

fitzoh commented Apr 1, 2017

Here are couple alternate suggestions @snicoll:

  • include the jackson module when web is included as a dependency. This avoids having logic to actually detect jackson, and makes things easier 90% of the time
  • always include the jackson module when kotlin is selected as the language, but leave it commented out with a usage note

Definitely understand the desire to reduce complexity. Not expecting these to be accepted, just throwing ideas out there.

@snicoll
Copy link
Contributor

snicoll commented Apr 2, 2017

@fitzoh thanks for the suggestions. Both have been evaluated and I am afraid that doesn't work:

  1. If we support something, we want it be consistent: if we do 1 .it's a call to a new issue that the dependency is not added when XYZ is used instead of the web starter.
  2. I am really not a fan of using commented code as documentation. We have plans to automatically generate a HELP.md with some info regarding the project (links, etc). We'll surely use what @sdeleuze has done for Kotlin and we will add a reference to what you're asking for sure.

#353 is very high on my list so I hope to apply your second suggestion (in a different manner) soon.

@fitzoh
Copy link

fitzoh commented Apr 2, 2017

Cool, that definitely sounds like the place for it... Cheers!

@geoand
Copy link

geoand commented May 22, 2017

Hello everyone,

I encountered this same issue and banged my head a while before finding the solution.
Furthermore I also struggled with Spring Data Reactive Mongo when using it with Kotlin before finding that I needed to include the org.jetbrains.kotlin.plugin.noarg gradle plugin.

From the perspective of a long time Spring Initializr user, it's the first time I recall that I didn't enjoy a totally frictionless experience.
I totally understand that logic behind not adding complexity into the Initializr codebase, but on the other hand there should be some fairly obvious way to warn/guide users on how to deal with these common issues.

Thanks for your time,
George

P.S. Currently I am using @sdeleuze's Mixit application as the canonical way to build a Spring Boot 2.x + Kotlin app.
That's where a find the solutions to the aforementioned issues.

@snicoll
Copy link
Contributor

snicoll commented May 22, 2017

@geoand this issue is closed and the Mongo issue is something unrelated to this issue. I've already replied for the Jackson part, I have no idea what you mean with the other issue.

Perhaps we could chat on Gitter? If you have a compelling use case for the mongodb part, please create a separate issue.

I don't think Initializr is supposed to fix the problem you experienced (at least the first one).

@geoand
Copy link

geoand commented May 22, 2017

@snicoll Sure thing! I will PM you on Gitter :)

@sdeleuze
Copy link
Contributor

Spring Framework 5.0.0.BUILD-SNAPSHOT now logs a warning at startup when Jackson + Kotlin are used without jackson-module-kotlin on the classpath, see SPR-15658 for more details. That does not solve the limitation on Initilizr but at least it will provide some hints when such situation is detected.

Also Spring + Kotlin documentation is coming with a specific mention about that topic.

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

No branches or pull requests

5 participants