O'Reilly logo

Apache Maven Cookbook by Raghuram Bharathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working in offline mode

There might be situations where a Maven project needs to be built without access to the Internet. Let us see how Maven supports this, as well as the caveats.

How to do it...

  1. Open a project that you want to build offline.
  2. Run the following command:
    mvn dependency:go-offline 
    
  3. Observe the output:
    How to do it...
  4. Run the following command:
    mvn –o clean package
    

Observe that the build is completed successfully without any network connection.

How it works...

The go-offline goal of the Maven Dependency plugin downloads all the required dependencies and plugins for the project, based on the pom file. The –o option tells Maven to work offline and not check ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required