$ mvn dependency:go-offline -Dmaven.repo.local=~/repository clean package install test site
オフラインで使う Maven の phase をすべて指定するのがミソ
$ mvn --offline package -Dmaven.repo.local=~/repository -Dmaven.legacyLocalRepo=true
/.m2/settings.xml で、offline 設定して、レポジトリを ~/.m2/repository にすればオプションを省略可能
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"> <offline>true</offline> </settings>
インターネットから遮断されている構築環境でビルドする