I tried using this plugin to move jarfiles from maven's target to an external dir after the build:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-files-on-build</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/../jarfiles</outputDirectory>
<resources>
<resource>
<directory>${build.directory}</directory>
<include>*.jar</include>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
But it only works from the second build onwards, it doesn't copy anything over on the first build.
I tried changing <phase>
to all of install
, deploy
, post-install
, post-deploy
, etc., but never got the files to copy across on the first mvn install
in that project (i.e. ./target
dir has not been created yet.)
How do I make sure the jars are copied every build (and that they are the most up-to-date, reflecting the current source.)