6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[WSL] Ubuntu-18.04へのmavenインストール

Posted at

前提

  • Ubuntu-18.04 on WSL

背景

mavenをインストールするにあたり、Ubuntuのapt公式リポジトリより上のバージョンが必要だったので、仕方なく手動でインストールしたときの備忘録。

バージョンの縛り等がなければ、sudo apt install mavenで入れたほうが管理の面でも良いと思う。
ちなみにaptで入るバージョンの確認はsudo apt policy maven

インストール

はじめに

公式のインストールガイドが常に最も正しい。

ダウンロード

/optディレクトリに移動し、mavenのバイナリをダウンロード。

cd /opt/
wget http://us.mirrors.quenda.co/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz

ダウンロードファイルを解凍し、リネーム。

tar -xf apache-maven-3.6.3-bin.tar.gz
mv apache-maven-3.6.3/ apache-maven/

環境変数の設定

/etc/profile.dディレクトリにmaven.sh設定ファイルを作成し、環境変数を指定。

echo 'export MVN_HOME="/opt/apache-maven"' >> /etc/profile.d/maven.sh
echo 'export PATH="${MVN_HOME}/bin:${PATH}"' >> /etc/profile.d/maven.sh
source /etc/profile.d/maven.sh

インストール確認

mvn --version
mvn --help
6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?