I have a Maven project consisting of several modules. I have one POM file that I use to invoke the assembly of all the dependent modules. I want to make a copy of several files in one place and fix them once, after the completion of the life cycle of the package of all submodules.
I studied antrun, but cannot figure out how to make it work once. It currently works during the package phase of each module. Here is my parent POM file (simplified)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<name>project</name>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>../module1</module>
<module>../module2</module>
</modules>
<dependencies>
...
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<mkdir dir="product" />
<copy todir="product">
<fileset dir="../module1/doc/release">
<include name="*.pdf" />
</fileset>
<fileset dir="../module2/doc/release">
<include name="*.pdf" />
</fileset>
<fileset dir="../module1/target">
<include name="*.war" />
</fileset>
<fileset dir="../module2/target">
<include name="*.war" />
</fileset>
</copy>
<copy file="app.properties" todir="cesium" />
<zip basedir="product" destfile="dist.zip"></zip>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
...
</properties>
Hope this is clear what I'm trying to do. I just want the antrun task to be executed after the package life cycle and only once, and not for each module.
, , , , , Maven. .