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
You can run maven in offline mode mvn -o install . Of course any artifacts not available in your local repository will fail. Maven is not predicated on distributed repositories, but they certainly make things more seamless.
In order to prepare for offline mode, we can use the go-offline goal from the maven-dependency-plugin: mvn dependency:go-offline. This goal resolves all project dependencies — including plugins and reports and their dependencies. After running this goal, we can safely work in offline mode.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With