3.1-1 dependencyManagement the type as pom usage

 
In Chapter 3 Example: Component confsvr spmia-chapter3-master of an example:
Pom file its contents are summarized as follows:
 
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.4.4.RELEASE</version>
  </parent>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>Camden.SR5</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
 
  <dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-config-server</artifactId>
    </dependency>
 
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>
  </dependencies>
 
We use the idea to import the project, the subproject open pom.xml file, and then select "show effective pom" Right, this will open a window called "configurationserver-effective-pom.xml" of.
The above <scope> import </ scope> shows a version introduced come Camden.SR5 dependent spring-cloud-dependencies pom corresponding file information.
So window called "configurationserver-effective-pom.xml" in <dependencyManagement> element will pom.xml open to expansion, so there will be a lot of content.
 
We analyze window called "configurationserver-effective-pom.xml" in <dependencyManagement> The final version of the content and number two dependencies in pom.xml element declaration:
  <dependencies>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-config-server</artifactId>
      <version>1.2.2.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-config</artifactId>
      <version>1.2.2.RELEASE</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
You will find <dependencyManagement> for version management is not only dependent on the sub-project, but also for version management of its own projects where the dependent.
 

Guess you like

Origin www.cnblogs.com/mongotea/p/11973195.html