Is there a maven command line option for offline mode?

You can specify in your maven settings file that you want to run in offline mode, but is there an equivalent command line option?

I would imagine something like e.g.

mvn install -Dmaven.offline.true

Specify offline mode via -o/--offline:

mvn -o install

Maven book reference


Just a simple:

mvn --offline

In the future, I recommend referring to mvn --help.


Maven's offline mode is invoked using mvn -o.

However, that alone may not be enough, because sometimes the current project refers to artifacts which are not yet present in the Maven local repository cache (~/.m2/repository). Attempting to build that project in offline mode will fail, because needed dependencies are missing and cannot be downloaded.

So there is another useful goal:

mvn dependency:go-offline

This is a great command to run before hopping on a plane, which will improve your chances of BUILD SUCCESS. See the go-offline documentation for details.