Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

convert maven local repository to remote repository

Tags:

maven-2

maven

I have a repository directory under .m2 that I want to use as a remote repository (-Dmaven.repo.remote=http://remotehostname/repo) to other hosts. I tried just to expose the directory .m2/repository/ under Apache as http://remotehostname/repo, the directory is fully visible via HTTP, but Maven doesn't seem to be reading from the exposed repo. For various reasons, I do not want to add this new remote repo to settings.xml; limit it to -Dmaven.repo.remote

What do I need to do to convert a local repo under .m2 as a remote repo?

like image 467
fruitJuice Avatar asked Oct 20 '11 00:10

fruitJuice


People also ask

What is remote repository in maven?

remote repositories refer to any other type of repository, accessed by a variety of protocols such as file:// and https:// . These repositories might be a truly remote repository set up by a third party to provide their artifacts for downloading (for example, repo.maven.apache.org).

Where is maven remote repository?

Maven remote repository is located on the web. Most of libraries can be missing from the central repository such as JBoss library etc, so we need to define remote repository in pom. xml file.


2 Answers

Further to @Perception's answer, you can look at Nexus Command Line tool, which can help convert your local repo to nexus repo

like image 175
Raghuram Avatar answered Oct 13 '22 13:10

Raghuram


I haven't heard of any maven repository manager that can simply mirror your .m2 folder (which is just a local repository). You need to install and configure repository management software ... there are many free, open source ones, I recommend Artifactory or Nexus.

Nexus does fit very closely with your requirements since it uses a file based repository, and the file layout matches with the local repo layout.

like image 26
Perception Avatar answered Oct 13 '22 15:10

Perception