Allow to react to the presence of dependencies in actions and Handlebar templates
It would be nice if the actions and templates of user commands could be bound to the presence of a certain dependency within the project. Something similar to project.dependencies.contains("*:foo-bar:*") with the String parameter handed in effectively matching the GAV strings for dependencies.
This can already be achieved for Handlebar templates by executing a command triggering the build system and binding the result to a variable:
actions:
- exec:
command: ./mvnw dependency:list | grep 'jakarta.persistence-api' || echo ''
define:
name: jpa-present
This would allow the templates to check {{#if jpa-present}}. That said, this is currently not supported within the action files themselves. Also, running the build system for each such variable is time-consuming. It would be nice if the CLI ran such a command one, caches it and monitors the build files for changes to refresh the model.