Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Caching the repository index in m2eclipse

everytime i start with a fresh new workspace, m2eclipse downloads nexus-maven-repository-index.gz from the maven central repository. this is good. but, some times, i just want to start a new workspace, and not wait for it to download, it tried copying the whole .metadata directory from an old workspace to the new one, but the list of maven artifacts are still empty. is there a way i can cache it? or at least download the file once, and the copy/extract/repackage it so that m2eclipse thinks it has already downloaded it and allows me to search for maven artifacts.

or a short version of the question where and in what format is the "nexus-maven-repository-index.gz" file stored in the workspace?

like image 256
Titi Wangsa bin Damhore Avatar asked Jul 24 '09 15:07

Titi Wangsa bin Damhore


3 Answers

The index is stored in the plugin's metadata location, i.e.

[workspace root]/.metadata/.plugins/org.maven.ide.eclipse/nexus

There will be one folder for each remote repository index in use.

You can configure the plugin to not download the index at startup too. Got to Window->Preferences->Maven and uncheck Download repository indexes at startup, you'll have to remember to reactivate it to get any updates though

Update: I just verified that copying the metadata works. M2Eclipse will still contact the repository to download the deltas (assuming the above option is checked), but that only takes a few moments as it is only downloading the deltas.

like image 93
Rich Seller Avatar answered Nov 01 '22 14:11

Rich Seller


Depending on your situation, you may want to try running a managed repository such as artifactory or nexus.

Configure it as the one-true-source-of-everything in maven, that way the initial download should only be from a local location and hence fast.

like image 38
Kevin Wright Avatar answered Nov 01 '22 15:11

Kevin Wright


There is similar problem in my company, due to the network/security restrictions, the index file can't be downloaded by m2eclipse.

I have tried to use apache, to direct maven.org to my localhost to provide the index.(it should work, you can try). But again, network restriction disables local pc level ds resolution.

Last solution is try to downlaod nexus-maven-repository-index.zip, extract everything inside this zip, except the timestamp file, and extract and replace everything into the corresponding index folder for central repository.

It works. :-D

like image 31
engineer Avatar answered Nov 01 '22 14:11

engineer