Ich habe ein Multi-Modul Maven Projekt bekommt, mit einer Struktur wie:Maven - hängt von mehrere Modulen Aggregator Projekt
projectA-parent
- module-1
- module-2
Und ich habe ein anderes Projekt, wo ich in allen Modulen bringen will in projectA-parent
als Laufzeitabhängigkeiten (es ist eine Spring-Anwendung, und jedes Modul in projectA-parent
enthält Spring-Dienste, die ich in der Lage sein soll, autowire).
Was ich möchte, ist, etwas zu tun wie
<dependency>
<groupId>projectA-group</groupId>
<artifactId>projectA-parent</artifactId>
<scope>runtime</scope>
</dependency>
so, dass, wenn ich ein anderes Modul zu projectA-parent
hinzufügen wird es automatisch als Laufzeitabhängigkeit gebracht (dh ich will nicht zu haben, füge jedes neue Modul als Abhängigkeit in meine Spring-Anwendung ein, wenn ich sie hinzufüge). Ist so etwas möglich?
Das Problem ist, dass die Module nicht Abhängigkeiten von "ProjektA-Eltern", sondern Untermodule sind. Meine aktuelle Lösung (die die beste/einzige Option sein könnte) ist ein "BOM" -Modul, das alle anderen Module als Abhängigkeiten auflistet. Importieren Sie dann diese Stückliste als Typ: pom/scope: Importabhängigkeit, wie in Ihrer Antwort. Die Abhängigkeiten sind als scope: runtime in der Stückliste pom.xml markiert. – bobsyouruncle