You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Edit Starters doesn't properly handle removal of all dependencies #52
When all dependencies are removed/unchecked from a boot project. The edit starters tends to create a broken project because it does not ensure that at leats a dependency like:
create a project with "new Spring starter". Select a single dependency (e.g. web).
Use "Edit starters" and remove the dependency.
=> The dependency is removed from the pom leaving no dependencies in the pom at all.
The project is now broken and has compile errors.
Expected behavior is that upon removal of the last dependency we ensure that at least a dependency on
the 'base' spring-boot-starter dependency exists. If it doesn't it should be added.
I just got a report from another user in slack chat, complaining about other discrepancies between edit starters and what intializer app generates.
Apparantly since this was implemented in STS quite a while ago, the initializer app has gotten a bit more sophisticated and it is not just a 1-1 mapping between a selected checkbox and a dependency. There are also some dependencies that get added as a kind of 'cross selection'. I.e. sometimes extra dependencies will get added as 'extra' when two boxes are selected together.
The example he gave was:
If I select RabbitMQ and Cloud Stream on a new project, I get the amqp starter, spring-cloud-stream, spring-cloud-stream-binder-rabbit and spring-cloud-stream-test-support.
If you instead only selects RabbitMQ intially; and subsequently add 'Cloud Stream' via edit starters. Then spring-cloud-stream-binder-rabbit and spring-cloud-stream-test-support are not being added.
I'm not totally sure yet how we can handle this. But admittedly I think it should be thought of as a bug.
I have some idea. Perhaps the 'Edit Starters' should be re-written from scratch so that it doesn't try to decide by itself how to create the edits. Instead, we could use initializr app to create two poms. One for the 'initial' state of the edit starters dialog selection, and then a second one for the edited state. Then we can compute some kind of a diff between the two poms, and then somehow use that diff to update the user's pom. I think this might be a better way, as it wouldn't need to know exactly how the initializer logic works internally. And perhaps it would solve all of these discrepancies at once (though I guess implementing the diffing system might be a little tricky, as I doubdt that simply doing a textual diff will be good enough).
Yes we also noticed the similar scenarios. I think the best way is to have related APIs telling the exact mapping of dependencies. Diffing XML content is also acceptable. But plain textual diff also has some pitalls, e.g. compare the following two BOMs :
Above commit only fixes the 'empty selection' case. It doesn't deal with more complex scenarios such as cross-selection of starters (i.e. where adding two dependencies together, causes other 'cross-election' dependencies to be added as well)
(comment in Pivotal Tracker added by Martin Lippert:)
I accepted this story, seems to work fine, but uncovered a little bug in the edit starters wizard, please also take a look at bug item #158427358. Thanks!!!
Activity
Eskibear commentedon May 2, 2018
The expected behavior is not enough, a corner case is found.
The starter
devtoolsonly introduces following dependency in runtime scope:So we still need to add the base starter back if it's the only starter of the project.
Ref:
microsoft/vscode-spring-initializr#64
kdvolder commentedon May 2, 2018
@Eskibear
I just got a report from another user in slack chat, complaining about other discrepancies between edit starters and what intializer app generates.
Apparantly since this was implemented in STS quite a while ago, the initializer app has gotten a bit more sophisticated and it is not just a 1-1 mapping between a selected checkbox and a dependency. There are also some dependencies that get added as a kind of 'cross selection'. I.e. sometimes extra dependencies will get added as 'extra' when two boxes are selected together.
The example he gave was:
If you instead only selects
RabbitMQintially; and subsequently add 'Cloud Stream' via edit starters. Thenspring-cloud-stream-binder-rabbitandspring-cloud-stream-test-supportare not being added.I'm not totally sure yet how we can handle this. But admittedly I think it should be thought of as a bug.
I have some idea. Perhaps the 'Edit Starters' should be re-written from scratch so that it doesn't try to decide by itself how to create the edits. Instead, we could use initializr app to create two poms. One for the 'initial' state of the edit starters dialog selection, and then a second one for the edited state. Then we can compute some kind of a diff between the two poms, and then somehow use that diff to update the user's pom. I think this might be a better way, as it wouldn't need to know exactly how the initializer logic works internally. And perhaps it would solve all of these discrepancies at once (though I guess implementing the diffing system might be a little tricky, as I doubdt that simply doing a textual diff will be good enough).
Eskibear commentedon May 3, 2018
Yes we also noticed the similar scenarios. I think the best way is to have related APIs telling the exact mapping of dependencies. Diffing XML content is also acceptable. But plain textual diff also has some pitalls, e.g. compare the following two BOMs :
kdvolder commentedon Jun 15, 2018
Above commit only fixes the 'empty selection' case. It doesn't deal with more complex scenarios such as cross-selection of starters (i.e. where adding two dependencies together, causes other 'cross-election' dependencies to be added as well)
spring-projects-issues commentedon Jun 18, 2018
(comment in Pivotal Tracker added by Martin Lippert:)
I accepted this story, seems to work fine, but uncovered a little bug in the edit starters wizard, please also take a look at bug item #158427358. Thanks!!!