Managing Dependencies with Maven in an Offline Environment

4

I do not know if what I'm going to ask is simple, or complex, but it turns out that I started using Maven a couple of weeks ago in college, in a somewhat complex Java EE discipline project. I installed Maven, everything right on my notebook and personal computer at home, everything is ok, but in my work the internet is quite restricted. After downloading the GitHub project it does not let Maven do the dependency downloads and says it was not possible to create the workspace. Is there any way I can export the dependencies of the notebook and take it to my work?

    
asked by anonymous 12.11.2014 / 02:53

2 answers

3

There are two main options for working offline on your computer using Maven.

Download everything in advance

The Maven dependencies are in the .m2 folder within your user directory.

If you know you are going to work offline, run the build dependency:go-offline for maven to try to cache everything it needs for a particular project.

If it is to work on another machine, after executing the above build, copy the .m2 folder to a pendrive and take it with you. Place this folder in the user directory of the target computer and Maven will not download the dependencies again.

Ignore Maven

You can also copy the required jars by running the build dependency:copy-dependencies .

All jars in your dependencies will be copied to the target/dependency folder. Just copy them to a pendrive and take it with you.

The downside is that you will have to disable Maven in the other environment and manually add the jars, being careful not to mistakenly commit the modified settings in your IDE.

    
12.11.2014 / 16:39
0

Yes, install Maven Proxy, configure and run:

  

link

If you want a more user friendly repository, install Artifactory:

  

link

    
12.11.2014 / 03:33