Skip to content

Instantly share code, notes, and snippets.

@olemma
Last active November 9, 2015 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olemma/2a344a5748befcb7acce to your computer and use it in GitHub Desktop.
Save olemma/2a344a5748befcb7acce to your computer and use it in GitHub Desktop.
Script to show a bug with maven dependency plugin
#!/usr/bin/env bash
# demonstrate a bug in maven dependency:copy-dependencies
# if useRepositoryLayout, copy-dependencies won't copy over the poms
# if the directory already exists
COPY=$(readlink -f _maven_bug_copy_dir)
rm -rf ${COPY}
rm -rf _maven_bug_commons-math
git clone https://github.com/apache/commons-math.git _maven_bug_commons-math
cd _maven_bug_commons-math
DEP_CD=org.apache.maven.plugins:maven-dependency-plugin:2.10
# copy only the jars
mvn -fn \
${DEP_CD}:copy-dependencies \
-DoutputDirectory=${COPY} \
-Dmdep.useRepositoryLayout=true \
# now get the poms too!
mvn -fn \
${DEP_CD}:copy-dependencies \
-DoutputDirectory=${COPY} \
-Dmdep.copyPom=true \
# overWriteReleases will fix the problem
# -DoverWriteReleases=true \
-Dmdep.useRepositoryLayout=true \
# where is the pom?
ls ${COPY}/junit/junit/4.11/*.pom
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment