「問題」は、モジュールの親pomは、複雑なプロファイルがなくても同じリリースサイクルでモジュールをロックすることです(Release Pluginを使用していると仮定します)。 (APIは、JUnitの、などをロギング)
各モジュールは、親のpomをその親としてdelcaresするが、親はモジュールについて何も知らない。
上記の最後の2つの箇条書きの「管理」セクションのメリットがあります。特定の依存関係やプラグインを使用するモジュールで、「管理」セクションに含まれるものはすべて再宣言する必要があります。
<project>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>1.0.00-SNAPSHOT</version>
...
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>2.1</version>
</dependency>
</dependencyManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</project>
、モジュールは次のようになります:
<project>
<parent>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>1.0.00-SNAPSHOT</version>
</parent>
<groupId>com.example</groupId>
<artifactId>module</artifactId>
<version>1.0.00-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
</dependencies>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
</plugin>
</plugins>
</project>
モジュールは、でしょう:親は次のようになります。例えば
- は
org.slf4j:slf4j-api:1.7.7:compile
に依存しています、 junit:junit:4.11:test
およびcommons-lang:commons-lang:2.6:compile
。
- 私は親のポンポンに依存を避けるだろうプラグイン
org.apache.maven.plugins:maven-assembly-plugin:2.4
Mavenでプロジェクトを設定する方法やマイクロサービスを使用する方法についてのリンクを教えてください。私は、私が移行を計画しているmavenベースのバネモノリシックサーバーを持っています。 – technazi
マイクロサービスでmavenプロジェクトを作成する具体的な方法はありません。私たちが持っているのは、小さなプロジェクトです。プロジェクトには次のことが必要です。API(エクスチェンジ(REST)など)、独自のサービス(コントローラーとエンティティの間のレイヤーとして使用)、独自のDBスキーマそれ。 POMは親のPOMを持っておらず、チームAがマイクロサービスAの仕事をし、チームBがMS Bの仕事をしているので、異なるマイクロサービスで使う共有のPOMプロジェクトを作成しません。 MS Bが共有プロジェクトを使用する場合、チームAがそれを変更すると、チームBはそれを知らない –