maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <>
Subject Re: Using dependency plugin to build minimal local repository to run unit tests
Date Thu, 10 Sep 2015 23:29:07 GMT
Hash: SHA1


I don't know if this would help:

1. Set up a repository on your local machine
2. Configure that repository to proxy remote repositories
3. Set your settings.xml to point to that local repository
4. Build normally

Then when you're off-line, you're not really off-line. Provided that
your local repository has pulled down all the dependencies, builds
should work as expected.

The downside of this is that it's a bit piggish on disk space.

I'm also not sure how to bounce back and forth between various
repositories, ie;

1. Connected to $work - you'll want to pull everything from that
   repository into your local repository
2. Connected to notwork - you'll probably want to use Central through
   your local repository

Almost sounds like you would need two different environments ($work
and notwork). This is probably best in any case.

. . . just my two cents

On 9/10/2015 4:16 PM, Andrew Wang wrote:
> 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

Version: GnuPG v2


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message