maven-dependency-plugin:copy
copies a single jar. I need to copy the jar and the pom to the appropriately named path in accordance with repository structure.
Use case: My project has a local repository, where I keep non-public dependencies. The dependencies are projects that I build on my machine and which get installed to the local machine's repository. After I copy the artifacts to the project's local repository, I can build the project on any machine which doesn't have the sources of the other projects. Using a project local repository is easy. You just need a folder with a particular directory structure and include this in the POM:
<repositories>
<repository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/libs</url>
</repository>
</repositories>
However, copying stuff into the local repo is an extra step I'd like to avoid. maven-dependency-plugin:copy
almost does what I need.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-private-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>...</groupId>
<artifactId>...</artifactId>
</artifactItem>
</artifactItems>
<outputDirectory>${project.basedir}/libs</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugins>
</build>
But it just copies the dependency's jar, without the pom and without the necessary directory structure.