Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Downloading complete maven remote repository to Local repository?

Is there any to get the entire remote repository, say from http://repo1.maven.org/maven2/ , to my local repository (to %USERPROFILE%)?

like image 798
srinannapa Avatar asked Mar 13 '10 20:03

srinannapa


People also ask

How do I download a Maven repository?

Open a web browser and browse the URL maven.org or search.maven.org. Input the jar library group name or artifact name in the search box, it will list all matched jar libraries. If you know the jar library group name, artifact name, and version, you can input something like g:com.

How do I re download all Maven dependencies?

In Maven, you can use Apache Maven Dependency Plugin, goal dependency:purge-local-repository to remove the project dependencies from the local repository, and re-download it again.

Where does Maven store artifacts downloaded from remote repository?

the local repository is a directory on the computer where Maven runs. It caches remote downloads and contains temporary build artifacts that you have not yet released.


2 Answers

From http://maven.apache.org/community.html:

Being a Good Maven Citizen

The concept of a public repository built into the core architecture of Maven makes it necessarily community-centric. There are a few simple things that Maven users may do to help keep that community thriving.

Be a Kind Public Repository User

The best thing that a user can do is to set up their own remote repository mirror containing the projects needed. There are several tools to make this simpler, such as Nexus or Archiva. This reduces strain on the Maven central repository, and allows new users to get acquainted with Maven easier and quicker. This is especially important for power-users and corporations. The incentive behind this is, controlling your own servers can give you desired level of security and more control over uptime, resulting in a better experience for your users. With that said, keep the following sentiment in mind:

DO NOT wget THE ENTIRE REPOSITORY!

Please take only the jars you need. We understand this is may entail more work, but grabbing all 9+ Gigs of binaries really kills our servers.

Host a Mirror

As an extention to the previous statement, if you have access to a large data repository with lots of bandwidth, please consider becomming a mirror for the Maven central repository.

As you can imagine, thousands of users downloading can put quite a strain on one server. If you wish to be a mirror, please file a request in the Maven Project Administration JIRA project.

Host a Public Repository

If you have any projects that you wish others to use, host them on your own public repository. That way, your users can simply add your repository to their own project repo list, and viola! Maven can keep you and your users in synch, growing your user-base due simply to its new-found ease of use.

Maybe if you explain why you'd like to get the whole central repo in %USERPROFILE% I could provide a better answer (if you you need to go offline, there are smarter solutions than getting 9+ gigs of artifacts). But for now, I don't get the point.

like image 124
Pascal Thivent Avatar answered Sep 28 '22 08:09

Pascal Thivent


I just had to mirror a private product repo to make available on another machine. lftp worked just fine:

$ lftp http://my.repo.example.com/product/maven
mirror --no-empty-dirs --parallel=3 . my-local-repo
like image 34
akostadinov Avatar answered Sep 28 '22 08:09

akostadinov