maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laird Nelson <ljnel...@gmail.com>
Subject Re: Using dependency plugin to build minimal local repository to run unit tests
Date Thu, 10 Sep 2015 23:35:18 GMT
Hello; you might also want to look at
https://maven.apache.org/plugins/maven-dependency-plugin/go-offline-mojo.html
.

Best,
Laird
--
http://about.me/lairdnelson

On Thu, Sep 10, 2015 at 4:29 PM Mark Eggers <its_toasted@yahoo.com.invalid>
wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Andrew,
>
> 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
> /mde/
>
> 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
> >
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
>
> iQEcBAEBAgAGBQJV8hJDAAoJEEFGbsYNeTwtRlwH/2Yh7Xz5PwKDX+fBVhT+WAaK
> dihjGnwfs0pIXrwa2jh3Vnw2t79CR5FiJf2f9+AGK75p8N47pJQiUpN7ioADmLuJ
> dox/CloSRl0XGNME1rhp5B+wgfafjYBE5tAY0DTVfIODYAjAKigXQvFDeAlCihHs
> HI/OMg0+Q+A9UTKDU/dcd15MnRDktmX+9iCPO+KOeEEOywYCIYclW1Pg95PEJKkA
> LaJ9WnckDhWsghAO5zj4j/+V4ByBm4RKO8mX0eQwSES7Fq4R2O0Mb6Q/mcz/Ap7v
> lvHbHbr5cGoDm6Ru7tYy8If6CkoirjUEqz+f0v0NXbY5N2s6l0rHnjz2gkydPTY=
> =NU1A
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message