wilkinsona / project-generator

3 stars 4 forks source link

webStarterContributor contributes starter unconditionally #29

Closed snicoll closed 5 years ago

snicoll commented 5 years ago

webStarterContributor brings the web started and tomcat in provided mode in case of war packaging. This happens irrespective of the state of the build. If the tomcat starter was already provided for instance, it is added twice in the pom.

wilkinsona commented 5 years ago

Perhaps we should use a set to hold the dependencies? That would mean that a dependency can always be added without having to check if something else has already done so.

snicoll commented 5 years ago

it looks more a new feature than a real problem actually. I've hit this by trying to let the old API call the new one and some logic still happens in the project request resolution (figuring out what to do and adding the tomcat starter if necessary is one of those). We've replicated that logic in a contributor so it runs twice in this unusual scenario.

Regarding the set, it is a good idea but the identity of a dependency is dependent of the context. Perhaps a way to query the build and then do something if the predicate match would be an interesting feature.

wilkinsona commented 5 years ago

but the identity of a dependency is dependent of the context

Good point. Perhaps we could add something in the pom.xml and build.gradle writers to avoid writing multiple identical entries? It'd be a nice insurance policy.

snicoll commented 5 years ago

We're back on our feet now with a container that registers dependencies by ID. We can reopen if that turns out to be a problem.