2017-04-11 9 views
1

私はマルチモジュールのセットアップをしています。親モジュールと2つのサブモジュール(子)、AとBです。モジュールBはAに依存しますが、モジュールAでspring-boot-maven-pluginを使用すると、コンパイルの依存関係は解決されませんモジュールBのコンパイル目標は「シンボルを見つけることができません」と「パッケージは存在しない」というエラーを投げます。そのプラグインを使用しないとすべて動作しますが、このプロジェクトでは削除できません。ここでspring-boot-maven-pluginは兄弟モジュールの依存関係を壊します

は、問題を再現する方法です:

親のpom.xml

<modelVersion>4.0.0</modelVersion> 
<groupId>com.whatever</groupId> 
<artifactId>theparent</artifactId> 
<version>2.7.0-SNAPSHOT</version> 
<packaging>pom</packaging> 
<modules> 
    <module>service</module> 
    <module>serviceClient</module> 
</modules> 
<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.5.2.RELEASE</version> 
</parent> 

モジュールA

<modelVersion>4.0.0</modelVersion> 
<artifactId>service</artifactId> 
<packaging>jar</packaging> 
<parent> 
    <groupId>com.whatever</groupId> 
    <artifactId>theparent</artifactId> 
    <version>2.7.0-SNAPSHOT</version> 
    <relativePath>../</relativePath> 
</parent> 

モジュールB

<modelVersion>4.0.0</modelVersion> 
<artifactId>serviceClient</artifactId> 
<parent> 
    <groupId>com.whatever</groupId> 
    <artifactId>theparent</artifactId> 
    <version>2.7.0-SNAPSHOT</version> 
    <relativePath>../</relativePath> 
</parent> 
<dependencies> 
    <dependency> 
     <groupId>com.whatever</groupId> 
     <artifactId>service</artifactId> 
     <version>2.7.0-SNAPSHOT</version> 
    </dependency> 
</dependencies> 

、すべてのあなたクラスを持っている必要がありますモジュールA、およびファーストクラスをインポートして使用するモジュールBの別のクラスです。親モジュールレベルで 'mvn clean install'を実行すると、コンパイルがうまくコンパイルされます。しかし、このプラグインはモジュールAに追加されると:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.springframework.boot</groupId> 
      <artifactId>spring-boot-maven-plugin</artifactId> 
      <configuration> 
       <mainClass>com.whatever.Application</mainClass> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

、モジュールBは、もはやモジュールAからの依存関係を解決することはできません、とあなたは「パッケージは存在しません」が表示されます、「シンボルを見つけることができない」などのメッセージモジュールAのクラスが見えないことを示します。

これはバグですか?誰も私がこの問題を回避するのを助けることができますか?

+0

希望この投稿は(https://github.com/spring-projects/spring-boot/issues/6792)お手伝いします。 –

+0

勿論、それが助けになりました。どうもありがとうございました。それを回答として提出すれば、私は承認するでしょう。 – bitsmcgee77

+0

どういたしまして。 –

答えて

2

希望このpostがお役に立てます。

関連する問題