java - Why version number in maven dependency is skipped at times? -
java - Why version number in maven dependency is skipped at times? -
i new maven's capabilities.. have seen in pom.xml dependencies put, @ times, groupid , artifact id mentioned , version skipped. why this? illustration below dependency springsource website http://spring.io/guides/gs/authenticating-ldap/
<dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-security</artifactid> </dependency> <dependency> <groupid>org.springframework.security</groupid> <artifactid>spring-security-ldap</artifactid> <version>3.2.4.release</version> </dependency> <dependency> <groupid>org.apache.directory.server</groupid> <artifactid>apacheds-server-jndi</artifactid> <version>1.5.5</version> </dependency> </dependencies>
but elsewhere in stackoverflow mentioned version not optional. glad if explain this.
yes, version not optional.
consider multimodule application has 10 modules, module1, module2.. module10.assume of these 10 projects utilize spring-boot-starter-web
. in case these 10 modules interdependent, might want utilize same version of spring-boot-starter-web
in each of these 10.
now imagine how complicated if maintain same version number in of these 10 pom files , update of them when want utilize newer version of spring-boot-starter-web
. wouldn't improve if info can managed centrally?
maven has got known <dependencymanagement/>
tag around , centralize dependency information.
for illustration have provided, below set of links help understand how version number resolved though it's not nowadays in pom looking at.
look @ parent tag of pom looking @ (https://github.com/spring-guides/gs-authenticating-ldap/blob/master/complete/pom.xml)
now lets go parent , see if versions specified in dependencymanagement section of pom(https://github.com/spring-projects/spring-boot/blob/master/spring-boot-starters/spring-boot-starter-parent/pom.xml). no it's not defined there well. lets @ parent of parent. https://github.com/spring-projects/spring-boot/blob/master/spring-boot-dependencies/pom.xml. oh yea, have got version numbers there.
similar dependencymanagement, plugins can managed in pluginmanagement section of pom.
hope explains it.
refer : dependencymanagement, pluginmanagement
java maven dependencies pom.xml
Comments
Post a Comment