2016-09-24 89 views
0

我現在用的這個POM到如何使用Spring MongoDB的數據和春季雲一起

<parent> 
     <groupId>org.springframework.cloud</groupId> 
     <artifactId>spring-cloud-starter-parent</artifactId> 
     <version>1.0.0.RELEASE</version> 
    </parent> 
<dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-mongodb</artifactId> 
      <exclusions> 
       <exclusion> 
        <groupId>org.springframework.boot</groupId> 
        <artifactId>spring-boot-starter-logging</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 

同時包括彈簧數據的MongoDB和春天一起雲在同一個項目。但現在,我需要升級的彈簧數據MongoDB的,這是POM父配置,我需要:

<parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.4.1.RELEASE</version> 
    </parent> 

現在的問題發生了,我仍然需要保持春雲,根據我的理解,我可以有在pom配置中只有一個父級,所以我必須保持spring-cloud-starter-parent,並且應該包含spring-boot-starter-parent。我可以問一下spring-cloud-starter-parent的哪個版本相當於spring-boot-starter-parent 1.4.1.RELEASE?

我改1.3.7.RELEASE,並得到了錯誤味精像這樣在我的IDE:

Project build error: Non-resolvable parent POM for org.test:ngcsc-api:0.0.1-SNAPSHOT: Failure to find org.springframework.cloud:spring-cloud-starter- 
    parent:pom:1.3.7.RELEASE in https://repository.cloudera.com/artifactory/cloudera-repos/ was cached in the local repository, resolution will not be reattempted 
    until the update interval of cloudera has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM 

所以我拿什麼在這種情況下怎麼辦?

回答

2

Spring雲可以與Spring Boot父項一起使用。

正如你可以在這裏看到:http://projects.spring.io/spring-cloud/ 所以這應該這樣做:

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <parent> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-parent</artifactId> 
     <version>1.4.1.RELEASE</version> 
    </parent> 
    <artifactId>Spring Boot</artifactId> 
    <name>Mongo</name> 
    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>org.springframework.cloud</groupId> 
       <artifactId>spring-cloud-dependencies</artifactId> 
       <version>Brixton.SR6</version> 
       <type>pom</type> 
       <scope>import</scope> 
      </dependency> 
     </dependencies> 
    </dependencyManagement> 
    <dependencies> 
     <dependency> 
      <groupId>org.springframework.cloud</groupId> 
      <artifactId>spring-cloud-starter-config</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-starter-data-mongodb</artifactId> 
      <exclusions> 
       <exclusion> 
        <groupId>org.springframework.boot</groupId> 
        <artifactId>spring-boot-starter-logging</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
    </dependencies> 
</project>