mercredi 8 avril 2015

When initalizing a project with the Spring Boot CLI, how do you specify "parameters" (e.g. language = groovy)?

Groovy and the Spring Boot CLI


I'm interested in using the strong Groovy support in Spring Boot to quickly prototype things where dynamic type-checking would be useful (e.g. slurping arbitrary JSON data).


I've installed GVM, and the Spring Boot CLI, and would like to use the latter's spring init command to create skeleton projects where Groovy is the primary language. The difference is only an extra dependency and some build plugins added to the Maven or Gradle build file... but still, it's nice to not have to look all of that up and cut-n-paste it from somewhere.


Available Options in the Web Service That Backs the CLI


When using the web-based http://start.spring.io service that backs the Spring Boot CLI, you can setup a skeleton Groovy project by simply selecting "Groovy" rather than "Java" in the "Language" pull-down. You can see that the CLI also understands this option. If you run spring init --list to list all of the possible options, then you'll see a "language" option in the "Parameters" section (with a default value of "java").


The spring init --list command actually displays three tables of options:



  1. Dependencies - e.g. web, security, data-jpa, etc.

  2. Project Types - e.g. maven, gradle

  3. Parameters - e.g. groupId, artifactId, etc... and language


Does the CLI Expose All of Those Available Options?


If you run spring help init, you can see that dependencies are specified with a -d or --dependencies flag. The project type is specified with a -t or --type flag.


However, there does NOT appear to be a flag for setting any of the options found in that "parameters" table. There are random flags for setting SOME of the possible parameters, and most of those aren't even spelled the same (e.g. --boot-version for the bootVersion parameter, and --java-version for the javaVersion parameter). However, I don't see any supported flag for setting "language"... or for that matter even the most commonly customized ones such as "groupId", "artifactId", etc.


I thought that perhaps "parameters" might mean exactly that... naked parameters that use no flag at all. However, the only such naked parameter that the CLI seems to take is the location of where to create the skeleton project.


Is this an oversight? I know that Spring Boot is still maturing, and the CLI doesn't seem to be its most widely-adopted feature. So perhaps it was just put together quickly with a fixed set of parameters exposed, rather than thinking through an expandable "parameter" flag as they did for "dependencies" and "types". Or am I missing something, and it IS somehow possible to set from the CLI those other options in the "parameters" table?


Aucun commentaire:

Enregistrer un commentaire