Maven without Internet connection

In fact the maven strenght is mainly in the internet accessible repositories and automatic dependency management. But it's possible to use this tool to build your project if you have all dependencies required for your project in your local repository. Then you may use -o option for offline mode and maven will not try to download updated artefact versions.

To get the artifacts into you local repository you have several options:

1) connect to the internet once and mvn build the project (this will download all required dependencies)

2) install dependencies as jar to the local repository manualy (using appropriate mvn command)


You need an internet connection. Maven isn't initially self-sufficient. It needs to download a bunch of plugins along with their dependencies and the dependencies of your own project. And this really depends on what sort of settings you have for your projects. One set up will require one set of dependencies, another - a whole different one. You can't download artifacts from the Maven Central manually and then install them locally one by one. Simply put, that sounds stupid.

I understand that you're coming from the Ant world where Ant has everything it needs on the local file system. However, Maven relies on the fact that it will have a central repository (either Maven Central, or your own repository - Nexus, Artifactory, etc.) from which to download the plugins and dependencies it needs. There is no point in you migrating to Maven, unless you'll be allowed access to the Central Maven Repository.

Yes, indeed, you can run Maven offline and you can have Maven produce a local repository for you to use when you are in offline mode. However, what you're trying to do is against Maven's principles.

If your company won't allow access to Maven Central, just stick to Ant. Your effort will be a waste of your company's and, ultimately, your own time.