Windowsにzipでインストールする
- 環境
- Windows10 Pro バージョン1909
- openjdk version "11" 2018-09-25
ある日、ビルドする用のバッチを実行したらMavenがないといわれた。
> mvn -v
'mvn' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
Eclipseで使っていただけだからMavenがインストールされていなかった、そんなときのお話。
- Maven – Download Apache Mavenを表示する
- [Files]にある[Binary zip archive]のリンクでzipファイルをダウンロードする
- 今回は
apache-maven-3.6.3-bin.zip
をダウンロード
- 今回は
- zipファイルを任意のフォルダに解凍する
- Win + R >
sysdm.cpl
で[システムのプロパティ]ダイアログ > [詳細設定]タブ > [環境変数]ボタンからダイアログを表示 -
解凍したzipフォルダ/bin
にパスを通す
#3. zipファイルを任意のフォルダに解凍する
$ unzip apache-maven-3.6.3-bin.zip -d /c/apps/
Archive: apache-maven-3.6.3-bin.zip
creating: /c/apps/apache-maven-3.6.3/
creating: /c/apps/apache-maven-3.6.3/lib/
creating: /c/apps/apache-maven-3.6.3/boot/
creating: /c/apps/apache-maven-3.6.3/lib/jansi-native/
creating: /c/apps/apache-maven-3.6.3/lib/jansi-native/freebsd32/
creating: /c/apps/apache-maven-3.6.3/lib/jansi-native/freebsd64/
creating: /c/apps/apache-maven-3.6.3/lib/jansi-native/linux32/
creating: /c/apps/apache-maven-3.6.3/lib/jansi-native/linux64/
creating: /c/apps/apache-maven-3.6.3/lib/jansi-native/osx/
creating: /c/apps/apache-maven-3.6.3/lib/jansi-native/windows32/
creating: /c/apps/apache-maven-3.6.3/lib/jansi-native/windows64/
creating: /c/apps/apache-maven-3.6.3/bin/
creating: /c/apps/apache-maven-3.6.3/conf/
creating: /c/apps/apache-maven-3.6.3/conf/logging/
creating: /c/apps/apache-maven-3.6.3/lib/ext/
inflating: /c/apps/apache-maven-3.6.3/README.txt
inflating: /c/apps/apache-maven-3.6.3/LICENSE
inflating: /c/apps/apache-maven-3.6.3/NOTICE
inflating: /c/apps/apache-maven-3.6.3/lib/cdi-api.license
inflating: /c/apps/apache-maven-3.6.3/lib/commons-cli.license
inflating: /c/apps/apache-maven-3.6.3/lib/commons-io.license
inflating: /c/apps/apache-maven-3.6.3/lib/commons-lang3.license
inflating: /c/apps/apache-maven-3.6.3/lib/guava.license
inflating: /c/apps/apache-maven-3.6.3/lib/guice.license
inflating: /c/apps/apache-maven-3.6.3/lib/jansi.license
inflating: /c/apps/apache-maven-3.6.3/lib/javax.inject.license
inflating: /c/apps/apache-maven-3.6.3/lib/jcl-over-slf4j.license
inflating: /c/apps/apache-maven-3.6.3/lib/jsoup.license
inflating: /c/apps/apache-maven-3.6.3/lib/jsr250-api.license
inflating: /c/apps/apache-maven-3.6.3/lib/org.eclipse.sisu.inject.license
inflating: /c/apps/apache-maven-3.6.3/lib/org.eclipse.sisu.plexus.license
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-cipher.license
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-component-annotations.license
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-interpolation.license
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-sec-dispatcher.license
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-utils.license
inflating: /c/apps/apache-maven-3.6.3/lib/slf4j-api.license
inflating: /c/apps/apache-maven-3.6.3/boot/plexus-classworlds.license
inflating: /c/apps/apache-maven-3.6.3/lib/jansi-native/freebsd32/libjansi.so
inflating: /c/apps/apache-maven-3.6.3/lib/jansi-native/freebsd64/libjansi.so
inflating: /c/apps/apache-maven-3.6.3/lib/jansi-native/linux32/libjansi.so
inflating: /c/apps/apache-maven-3.6.3/lib/jansi-native/linux64/libjansi.so
inflating: /c/apps/apache-maven-3.6.3/lib/jansi-native/osx/libjansi.jnilib
inflating: /c/apps/apache-maven-3.6.3/lib/jansi-native/windows32/jansi.dll
inflating: /c/apps/apache-maven-3.6.3/lib/jansi-native/windows64/jansi.dll
inflating: /c/apps/apache-maven-3.6.3/bin/m2.conf
inflating: /c/apps/apache-maven-3.6.3/bin/mvn.cmd
inflating: /c/apps/apache-maven-3.6.3/bin/mvnDebug.cmd
inflating: /c/apps/apache-maven-3.6.3/bin/mvn
inflating: /c/apps/apache-maven-3.6.3/bin/mvnDebug
inflating: /c/apps/apache-maven-3.6.3/bin/mvnyjp
inflating: /c/apps/apache-maven-3.6.3/conf/logging/simplelogger.properties
inflating: /c/apps/apache-maven-3.6.3/conf/settings.xml
inflating: /c/apps/apache-maven-3.6.3/conf/toolchains.xml
inflating: /c/apps/apache-maven-3.6.3/lib/ext/README.txt
inflating: /c/apps/apache-maven-3.6.3/lib/jansi-native/README.txt
inflating: /c/apps/apache-maven-3.6.3/boot/plexus-classworlds-2.6.0.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-embedder-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-settings-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-settings-builder-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-plugin-api-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-model-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-model-builder-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-builder-support-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-resolver-api-1.4.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-resolver-util-1.4.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-shared-utils-3.2.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/commons-io-2.5.jar
inflating: /c/apps/apache-maven-3.6.3/lib/guice-4.2.1-no_aop.jar
inflating: /c/apps/apache-maven-3.6.3/lib/guava-25.1-android.jar
inflating: /c/apps/apache-maven-3.6.3/lib/javax.inject-1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/jsr250-api-1.0.jar
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-utils-3.2.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-sec-dispatcher-1.4.jar
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-cipher-1.7.jar
inflating: /c/apps/apache-maven-3.6.3/lib/slf4j-api-1.7.29.jar
inflating: /c/apps/apache-maven-3.6.3/lib/commons-lang3-3.8.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-core-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-repository-metadata-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-artifact-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-resolver-provider-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-resolver-impl-1.4.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-resolver-spi-1.4.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/org.eclipse.sisu.inject-0.3.4.jar
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-component-annotations-2.1.0.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-compat-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/plexus-interpolation-1.25.jar
inflating: /c/apps/apache-maven-3.6.3/lib/wagon-provider-api-3.3.4.jar
inflating: /c/apps/apache-maven-3.6.3/lib/org.eclipse.sisu.plexus-0.3.4.jar
inflating: /c/apps/apache-maven-3.6.3/lib/cdi-api-1.0.jar
inflating: /c/apps/apache-maven-3.6.3/lib/commons-cli-1.4.jar
inflating: /c/apps/apache-maven-3.6.3/lib/wagon-http-3.3.4-shaded.jar
inflating: /c/apps/apache-maven-3.6.3/lib/jsoup-1.12.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/jcl-over-slf4j-1.7.29.jar
inflating: /c/apps/apache-maven-3.6.3/lib/wagon-file-3.3.4.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-resolver-connector-basic-1.4.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-resolver-transport-wagon-1.4.1.jar
inflating: /c/apps/apache-maven-3.6.3/lib/maven-slf4j-provider-3.6.3.jar
inflating: /c/apps/apache-maven-3.6.3/lib/jansi-1.17.1.jar
# 5. `解凍したzipフォルダ/bin`にパスを通す
$ printenv PATH | sed -e 's/:/\n/g' | grep maven
/c/apps/apache-maven-3.6.3/bin
# バージョン確認でパスが通っていることを確認する
$ mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\apps\apache-maven-3.6.3
Java version: 11, vendor: Oracle Corporation, runtime: C:\apps\Java\jdk-11
Default locale: ja_JP, platform encoding: MS932
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Mac
いつかやったら書こう