raffian
raffian

Reputation: 32076

Using springboot starter POMs for development and production

Why do most example projects for Springboot use starter POMs without a version? The documentation makes no mention of what version is being used.

For instance, using web starter without a version...

compile "org.springframework.boot:spring-boot-starter-web" 

...I'm assuming pulls the latest snapshot based on the POM? I suppose that's convenient for development, but then again, I've never used dependencies without a version number, so this feels strange.

Is it safe to use starter packages for production if I configure the dependency with a specific version, such as the example below, or should starters be used for development only?

  compile "org.springframework.boot:spring-boot-starter-web:1.2.1" 

Upvotes: 0

Views: 555

Answers (1)

Stephane Nicoll
Stephane Nicoll

Reputation: 33111

The examples do not define any version because these are managed by a so-called dependency management section. Maven has such support for years and we added the necessary to offer a similar experience with Gradle.

This is actually a very sane practice: if you have a project with several modules, you should rationalize the versions that you are using in one central place; you should also make sure your project uses a consistent version of a dependency or a set of dependencies.

This is also described in the documentation

I would recommend you to use this practice across the board: writing down the version in each module means that you have to update that at multiple places when you need to upgrade. Of course, you should scope that properly: unrelated projects shouldn't share the same dependency management section as you may want to upgrade libraries version independently.

Upvotes: 2

Related Questions