简体   繁体   中英

Work offline with all Maven repositories

I need to work offline using Maven , therefore, before going offline I should download all the project dependencies using Maven .

  1. In case I use ALL Maven repositories, how much space it would take?

  2. Is there a simple way I can download all Maven dependencies known to mankind?

I want to stay offline for security reasons. And I'm not sure about the Maven dependencies that will be added in the process of development.

As said above, downloading all possible Maven dependencies is no good choice. MavenCentral probably consists of several TB, and if you try to download all of it, you may end up on the blacklist.

Our company network is also not directly connected to MavenCentral. Instead, we run our own Nexus and have a copy job that copies a requested and approved dependency (with all its transitive dependencies) to our company Nexus.

You can do the same, or use your local repository on your computer for this purpose.

One other approach would be to create a dummy project on a computer connected to the internet, put every direct dependency in the pom of the dummy project and let Maven download everything you need. Then you can copy the repo from the dummy project to your real project.

Of course, in both cases, the steps have to be executed every time you add a dependency.

Before going offline try to find out the dependencies you need.

Then do an update project on maven. It will do download all the dependencies for you. And then you can remain offline as long as you don't need to add any other dependency.

You can use this command:

mvn clean install -U

If you are using Eclipse for your project, then right click on the project -> Select Maven -> Update Project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM