2017-06-22 2 views
1

親プロジェクトが私の共通プロジェクトで、他のすべてのモジュールがこのカスタム親プロジェクトに依存し、 org.springframework.cloud "を親プロジェクトとして使用します。親プロジェクトがorg.springframework.cloudではないスプリングブートクラウドメイプベースアプリケーションの作成方法

私はMavenのモジュール階層内の親として春の雲を追加したくない私の親ポンポン簡単な言葉で

<parent> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId>spring-cloud-starter-parent</artifactId> 
    <version>Brixton.BUILD-SNAPSHOT</version> 
    <relativePath/> 
    <!-- lookup parent from repository --> 
</parent> 

でこれを追加する必要はありません。あなたは春の初期化子Spring Initializerを使用してプロジェクトを生成する場合、あなたは「

<?xml version="1.0" encoding="UTF-8"?> 

http://maven.apache.org/xsd/maven-4.0.0.xsdを取得

> 4.0.0

<groupId>com.example</groupId> 
<artifactId>demo</artifactId> 
<version>0.0.1-SNAPSHOT</version> 
<packaging>jar</packaging> 

<name>demo</name> 
<description>Demo project for Spring Boot</description> 

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.5.4.RELEASE</version> 
    <relativePath/> <!-- lookup parent from repository --> 
</parent> 

<properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 
    <java.version>1.8</java.version> 
</properties> 

<dependencies> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-actuator</artifactId> 
    </dependency> 

    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-starter-test</artifactId> 
     <scope>test</scope> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
     </plugin> 
    </plugins> 
</build> 

+0

、のように見える、(私は「ファイン&クリーン」な答えを投稿する(またそれを試して)時間がありませんが、解決策は、すべてをコピーすることは明らかですあなたの親(親)ポームへのspring-cloud-starter-parent pomからの関連性。 – xerx593

答えて

1

親セクションを削除し、春ブーツに持参BOMなどの管理を依存関係。

<dependencyManagement> 
    <dependencies> 
    <dependency> 
     <groupId>org.springframework.boot</groupId> 
     <artifactId>spring-boot-dependencies</artifactId> 
     <version>1.5.4.RELEASE</version> 
     <type>pom</type> 
     <scope>import</scope> 
    </dependency> 
    </dependencies> 
</dependencyManagement> 
+0

親から継承されたデシジョンのバージョンを与える方法? –

1

pom.xmlファイルに<dependencyManagement>セクションを追加する必要があります。 ..sry

<dependencyManagement> 
<dependencies> 
    <dependency> 
     <groupId>org.springframework.cloud</groupId> 
     <artifactId>spring-cloud-dependencies</artifactId> 
     <version>Dalston.SR1</version> 
     <type>pom</type> 
     <scope>import</scope> 
    </dependency> 
</dependencies> 

関連する問題