Watch for dependency name typos when creating new Spring Boot projects

If you use the Spring Boot CLI, it’s pretty easy to get a new project created from the templates with all required dependencies in place with something like:

spring init --build=maven --dependencies=web

This generates you a zip that you can unzip and import into your IDE and off you go. The trouble with the CLI currently though is that there’s no validation on the dependency names, so if you call

spring init --build=maven --dependencies=wb

You’ll get the same zip generated, but there will be a subtle typo in your dependencies which unless you’ve seen these messages from maven before, you’ll spend a bunch of time trying to work out what’s wrong.

I created a ticket for this issue here, and hopefully this gets picked up as an enhancement.

The maven error in case you’re interested looks like this:

[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   The project com.example:testbaddep:0.0.1-SNAPSHOT (/Users/kev/develop/spring-boot/testbaddep/pom.xml) has 1 error
[ERROR]     'dependencies.dependency.version' for org.springframework.boot:spring-boot-starter-wb:jar is missing. @ line 27, column 15
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.