Skip to content
This repository has been archived by the owner on Nov 6, 2021. It is now read-only.

Use of a local maven repo and save time downloading artifacts #29

Closed
michaeldunstan opened this issue Feb 19, 2015 · 3 comments
Closed

Comments

@michaeldunstan
Copy link
Contributor

It would be useful to have some documentation of how to make use of a local maven repository.

I've tried the suggestion in #22 about using a synced_folder but have not been completely successful with that. The first trial was setting up vagrant with a synced folder for the user vagrant like so:

  config.vm.synced_folder File.expand_path("~/m2-repository"), "/home/vagrant/.m2/repository"

Where ~/m2-repository is an empty directory on my host. This never seemed to be used by maven. I checked while running and after completion of vagrant up but there were never any files in ~/m2-repository.

For the second trail the synced folder was set up for the root user in the VM using:

  config.vm.synced_folder File.expand_path("~/m2-repository"), "/root/.m2/repository"

This time I could see that files were being saved into ~/m2-repository while vagrant up was running. But then all the files were removed just before vagrant up completed.

What directory (and user) should be used for the local maven repo within the VM? And is there some setting (or command) that is clearing out the local maven repo at the end of running all the recipes?

@maoo
Copy link
Contributor

maoo commented Feb 19, 2015

We could add to artifact-deployer the capability to wire -Dmaven.repo.local (if defined by configuration), which would force Maven to use the given repository (whether empty or not).

And yes, artifact-deployer purges - by default - all Maven settings, since I don't want (especially if following an immutable container provisioning paradigm) any trace of provisioning in my box.

https://github.com/maoo/artifact-deployer/blob/master/recipes/default.rb#L40

You can disable it defining

"maven" : {
  "purge_settings" : false
}

@michaeldunstan
Copy link
Contributor Author

Thanks @maoo. With an empty local repository it takes about 60 minutes for vagrant up to complete for me. With a complete local repository that comes down to about 9 minutes.

Out of interest, if a synced_folder is being used to initially create the VM using an existing local repository you could then remove trace of that provisioning by removing the synced_folder from the vagrant configuration?

@maoo
Copy link
Contributor

maoo commented Feb 27, 2015

Being synced, I'd expect files to be copied over, but I haven't tried, so Im not sure

maoo added a commit that referenced this issue Nov 15, 2015
Former-commit-id: 638cd70ca749cb2502a8a81a2b57b84c663e327d [formerly 638cd70ca749cb2502a8a81a2b57b84c663e327d [formerly 6a27c58]]
Former-commit-id: 0ddcd90
Former-commit-id: 408d96e
Former-commit-id: ff008f2
maoo added a commit that referenced this issue Nov 15, 2015
Former-commit-id: 638cd70ca749cb2502a8a81a2b57b84c663e327d [formerly 638cd70ca749cb2502a8a81a2b57b84c663e327d [formerly 638cd70ca749cb2502a8a81a2b57b84c663e327d [formerly 6a27c58]]]
Former-commit-id: 0ddcd90
Former-commit-id: 408d96e
Former-commit-id: ff008f2
Former-commit-id: ccaa77f
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants