У меня есть многомодульный проект со структурой, подобной:
my-project
- moduleA
- moduleB
- moduleC
pom. xml для модуля A, настроенного как:
<profiles>
<profile>
<id>withArtifacts</id>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.ekiryuhin</groupId>
<artifactId>moduleB</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ekiryuhin</groupId>
<artifactId>moduleC</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>
moduleB,moduleC
</includeArtifactIds>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Тогда:
- Добавьте некоторый код в классы внутри
moduleB
и moduleC
. cd
до my-project/moduleA
. - Выполнить
mvn clean install -PwithArtifacts -DskipTests -am
И, наконец, у меня есть файлы jar в ${project.build.directory}/lib
, но они не содержат мои правки из (1).
Почему maven может не перестраивать зависимости перед копированием?
UPD:
pom. xml из модуля B: