spring-io / initializr

A quickstart generator for Spring projects
https://start.spring.io
Apache License 2.0
3.46k stars 1.74k forks source link

Add support for logical dependency #152

Open snicoll opened 9 years ago

snicoll commented 9 years ago

It would be nice that Spring Initializr had the concept of logical dependency (that is a dependency entry that represents several dependencies).

Concretely, this means that adding a dependency (a checkbox in the UI) has the effect of adding several dependencies in the project. This is a good alternative for things that are frequently used but for which we don't want/need an explicit starter.

151 is a good example

rwinch commented 8 years ago

@snicoll Another good example would be adding Spring Security should also add spring-security-test.

snicoll commented 8 years ago

I guess you mean the security starter, right?

rwinch commented 8 years ago

@snicoll Right. If you add spring-security-starter, then it should also add spring-security-test.

ndrone commented 8 years ago

I wrote something like this in the fork that Kroger (the company I work for) is using. Let me see if I can pull it from there and contribute.

sdeleuze commented 7 years ago

Maybe this issue could allow to fix the very annoying Kotlin module issue described in #400, by managing logicial dependencies with language related conditions.

snicoll commented 7 years ago

Unfortunately I believe it would not. If that was so easy, we would have cooked a request post processor by now.

The problem with the issue described in #400 is that we have no way to know that jackson has been added but to inspect the transitive dependencies of the starters that were selected by the user. I believe documentation (and the guide you offered to write in #400) are a more realistic option at this point.

sdeleuze commented 7 years ago

I truly understand this is not an easy one, but even with documentation, projects using Boot + Kotlin + Jackson (vast majority of Kotlin projects) are broken out of the box for use cases as simple as writing a REST webservice. IMO even experienced developers will forget to add it 50% of the time because with start.spring.io, we have the habits of just generating a project, write classes, run and it works. So when I saw this issue I thought it would be interesting to discuss if it could be use to help for such use case (even if maybe it is not).

Having the capability to add a post-processor able to inspect transitive dependencies and add jackson-kotlin-module dependency when jackson-databind is found in transitive dependencies and when "language == 'kotlin'" would be awesome, but as you said that's not possible easily currently and that's not what I had in mind.

My proposal is a more basic approach where we leverage the new feature discussed here to add for dependencies like "Web" and "Reactive Web" (maybe a few others like "Ratpack" or "Vaadin" if that makes sense) an additional jackson-kotlin-module dependency if a condition like "language == 'kotlin'" is fulfilled. This is not a perfect solution (duplication in the meta-data, will not cover all use cases if we focused on the most common dependencies requiring Jackson) but given the current set of constraints, I thought it could be a possible one.

Any thoughts?

snicoll commented 7 years ago

Any thoughts?

Yes, I don't think this discussion belongs here as I really think this request is unrelated to what you are trying to address. Can you please copy/paste your comment in a new issue and we can take it from there?

snicoll commented 6 years ago

We'd like to experiment some metadata change where we'd be able to provide a versionRange constraint and additional dependencies when that constraint matches. This would replace 3 post processors we currently have in initializr-service that look identical.