Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i move local maven repository to internal repository when i set the internal repo for the first time?

i wanted to setup artifactory as internal repo after i had actually used maven and populated my local repository during various builds. Before I set up artifactory on my machine, my local repository has already downloaded various libraries on to my local machine under .m2. Now I am setting up internal repo using Artifactory. Is there a quick way to move my local repository under .m2 to artifactory so that i don't have to again download all the libraries to get my artifactory up with the required libs.

Currently what i have to do is remove all folders under local repo (.m2\repository) and then allow my maven build to download on to artifactory. I am looking for a more efficient way to do this.

like image 614
arunram Avatar asked May 31 '11 01:05

arunram


1 Answers

You've got a number of options:

  • Assuming that you would like to push all artifacts into one repository and keep the same folder structure as in your file-system, Artifactory's got a number of good import utilities in its administration UI at:

Admin->Import & Export->Repositories->Import Repository from Path.

  • For more flexibility, you can write a simple script that iterates over the .m2 folder and sends an HTTP PUT command for every artifact and thus be able to customize the paths and target repositories, for example: curl -X PUT -u username:password -T path/to/file.jar "http://myhost:8080/artifactory/my-target-repo/path/to/file.jar"
like image 84
noamt Avatar answered Sep 30 '22 04:09

noamt