Hello. I'd like to, for an arbitrary project (in other words, a project for which I cannot edit the pom.xml files), copy the project's artifacts and the project's dependency artifacts into a directory.
The maven-dependency-plugin copy-dependencies goal *nearly* does this, but it'll fail as soon as it's asked to copy an artifact from the reactor. For example, if I pick one of my projects at random and run: $ cd git/com.github/io7m/jregions $ mvn dependency:copy-dependencies -DincludeScope=runtime \ -DoutputDirectory=/tmp/out/ [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] com.io7m.jregions [pom] [INFO] com.io7m.jregions.core [jar] [INFO] com.io7m.jregions.generators [jar] [INFO] com.io7m.jregions.documentation [jar] [INFO] com.io7m.jregions.tests [jar] [INFO] [INFO] ----------------< com.io7m.jregions:com.io7m.jregions >----------------- [INFO] Building com.io7m.jregions 2.1.0-SNAPSHOT [1/5] [INFO] --------------------------------[ pom ]--------------------------------- [INFO] [INFO] --- maven-dependency-plugin:3.1.0:copy-dependencies (default-cli) @ com.io7m.jregions --- [INFO] [INFO] --------------< com.io7m.jregions:com.io7m.jregions.core >-------------- [INFO] Building com.io7m.jregions.core 2.1.0-SNAPSHOT [2/5] [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-dependency-plugin:3.1.0:copy-dependencies (default-cli) @ com.io7m.jregions.core --- [INFO] com.io7m.junreachable:com.io7m.junreachable.core:jar:2.1.1 already exists in destination. [INFO] com.io7m.jaffirm:com.io7m.jaffirm.core:jar:2.0.0 already exists in destination. [INFO] [INFO] -----------< com.io7m.jregions:com.io7m.jregions.generators >----------- [INFO] Building com.io7m.jregions.generators 2.1.0-SNAPSHOT [3/5] [INFO] --------------------------------[ jar ]--------------------------------- Downloading from apache-snapshots-repo: https://repository.apache.org/content/repositories/snapshots/com/io7m/jregions/com.io7m.jregions.core/2.1.0-SNAPSHOT/maven-metadata.xml Downloading from sonatype-snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/com/io7m/jregions/com.io7m.jregions.core/2.1.0-SNAPSHOT/maven-metadata.xml Downloading from apache-snapshots-repo: https://repository.apache.org/content/repositories/snapshots/com/io7m/jregions/com.io7m.jregions.core/2.1.0-SNAPSHOT/com.io7m.jregions.core-2.1.0-SNAPSHOT.jar Downloading from sonatype-snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/com/io7m/jregions/com.io7m.jregions.core/2.1.0-SNAPSHOT/com.io7m.jregions.core-2.1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] com.io7m.jregions 2.1.0-SNAPSHOT ................... SUCCESS [ 1.008 s] [INFO] com.io7m.jregions.core ............................. SUCCESS [ 0.212 s] [INFO] com.io7m.jregions.generators ....................... FAILURE [ 1.921 s] [INFO] com.io7m.jregions.documentation .................... SKIPPED [INFO] com.io7m.jregions.tests 2.1.0-SNAPSHOT ............. SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.669 s [INFO] Finished at: 2018-10-21T18:59:31+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project com.io7m.jregions.generators: Could not resolve dependencies for project com.io7m.jregions:com.io7m.jregions.generators:jar:2.1.0-SNAPSHOT: Could not find artifact com.io7m.jregions:com.io7m.jregions.core:jar:2.1.0-SNAPSHOT in apache-snapshots-repo (https://repository.apache.org/content/repositories/snapshots) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :com.io7m.jregions.generators Is there a way to do this? My goal is to be able to type: $ cd git/com.github/io7m/jregions $ mvn magic-copier:copy -DoutputDirectory=/tmp/out ... and end up with all of the project's runtime artifacts, and the transitive runtime-scoped dependencies of the project, in /tmp/out. I'm not opposed to writing a custom plugin to do this, but I'd prefer to avoid that if possible. -- Mark Raynsford | http://www.io7m.com
pgpwWYQEXKzs9.pgp
Description: OpenPGP digital signature
