我的项目的简化设置如下:如何防止在maven-assembly-plugin中指定兄弟模块的版本?
root |--parent |--service-1 |--service-2 |--service-aggregator
我需要装配“服务-1” &“服务-2”模块“服务聚合器”。我正在使用maven-assembly-plugin的相同,它工作正常,但我预见维护问题,其中无论任何service-1或service-2的版本将更改,我将需要更新service-aggregator pom。 xml也。
因此,我正在寻找一种方法来防止在service-aggregator pom.xml中编写service-1/-2的版本,即我只需要service-aggregator来简单地选择最新版本的service-1/-2。
我已经通过了maven-assembly-plugin documentation中提供的示例,但那些包含汇编模块(在我的示例中为服务聚合器)中提到的版本。
请让我知道,如果有任何细节丢失&我会添加它。
这里是服务聚合的pom.xml的重点内容:
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company.project</groupId>
<artifactId>parent</artifactId>
<version>0.0.1</version>
</parent>
<groupId>com.company.project.parent</groupId>
<artifactId>service-aggregator</artifactId>
<name>service-aggregator</name>
<dependencies>
<dependency>
<groupId>com.company.project.parent</groupId>
<artifactId>service-1</artifactId>
<version>0.0.1</version> <!-- this is the line troubling me -->
</dependency>
<dependency>
<groupId>com.company.project.parent</groupId>
<artifactId>service-2</artifactId>
<version>0.0.1</version> <!-- this is the line troubling me -->
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<skipAssembly>${skip.assembly}</skipAssembly>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<skip.assembly>false</skip.assembly>
</properties>
这可能会帮助https://stackoverflow.com/questions/30571/how-do-i-tell-maven-to-use-the-late -A-依赖ST-版本的 – Rohan