Reputation: 1409
I have multi-module project with structure like:
my-project
- moduleA
- moduleB
- moduleC
pom.xml for moduleA configured like:
<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>
Then:
moduleB
and moduleC
. cd
to my-project/moduleA
. mvn clean install -PwithArtifacts -DskipTests -am
And finally I have jar files in ${project.build.directory}/lib
but they do not contain my edits from (1).
Why maven may do not rebuild dependencies before copy?
UPD:
pom.xml from moduleB:
Upvotes: 0
Views: 684
Reputation: 35805
You need build all the modules for that. Go the main project my-project
and call mvn clean install
. You also need to make sure that moduleA depends on moduleB and moduleC so that the build order will be correct.
Upvotes: 1