Hi Maven experts,

I'm trying to get a minimal set of local repository contents to be able to
run unit tests for a project in offline mode. The dependency plugin
documentation indicates that by default it's test scope, which is just what
I want, so I did something like this (Maven 3.0.4):

# Copy what I can from my existing local repository to my temp repo
mvn dependency:copy-dependencies -Dmdep.useRepositoryLayout=true
-DoutputDirectory=/tmp/hadoop-deps -Dmdep.copyPom
# Download things missed by copy:dependencies
mvn dependency:go-offline -Dmaven.repo.local=/tmp/hadoop-deps
# Try running offline unit test
mvn -o surefire:test -Dtest=TestFoo -Dmaven.repo.local=/tmp/hadoop-deps

This was still missing some dependencies, so I ran this which downloaded
some more:

mvn surefire:test -DskipTests -Dmaven.repo.local=/tmp/hadoop-deps

Invoking offline maven to run TestFoo still failed though, this time
missing Surefire. After doing dependency:get on that, my offline test
finally worked.

Is this expected behavior? I expected dependency:go-offline to be
sufficient for this purpose. I'm was also very surprised that running `mvn
surefire:test -DskipTests` did not download all the required dependencies.

If you have ideas on how better to do this, I'm also all ears :) This is
related to some distributed testing experiments I'm doing for Apache Hadoop
and HBase, which will hopefully be put into broader use upstream at some
point.

Thanks,
Andrew

Reply via email to