2014년 2월 4일 화요일

Mac에서 Maven 설치하기

Maven 다운로드


1. http://maven.apache.org 에서 MAVEN 최신 버전을 다운로드 받아 압축을 풀면 됩니다. 2010/12 현재 릴리즈 최신 버전은 3.0.1 입니다.
2. 다운받은 xxx-3.1.1-bin.tar.gz을 /usr/local/ 에 복사한다.
3. 압축풀기

  
hongseongmin-MacBook-Pro:local root# ls -al
total 37280
drwxr-xr-x 12 root wheel 408 Oct 30 14:53 .
drwxr-xr-x@ 11 root wheel 374 Oct 23 10:27 ..
-rw-r--r--@ 1 hongseongmin staff 5494427 Oct 30 14:53 apache-maven-3.1.1-bin.tar.gz
drwxr-xr-x@ 14 hongseongmin staff 476 Oct 23 10:27 apache-tomcat-6.0.35
-rw-r--r--@ 1 hongseongmin staff 6697806 Jul 27 2012 apache-tomcat-6.0.35.tar.gz
drwxr-xr-x 13 root wheel 442 Oct 23 10:27 apache-tomcat-6.0.37
-rw-r--r--@ 1 hongseongmin staff 6885442 May 4 21:20 apache-tomcat-6.0.37.tar.gz
drwxr-xr-x 21 root wheel 714 Oct 23 10:27 bin
drwxr-xr-x 5 root wheel 170 Oct 23 10:27 include
drwxr-xrwx 23 root wheel 782 Oct 30 13:41 lib
drwxr-xr-x 8 root wheel 272 Oct 23 10:27 sbin
drwxr-xr-x 4 root wheel 136 Oct 23 10:27 share
hongseongmin-MacBook-Pro:local root# gunzip apache-maven-3.1.1-bin.tar.gz

 

hongseongmin-MacBook-Pro:local root# ls -al
total 39304
drwxr-xr-x 12 root wheel 408 Oct 30 14:54 .
drwxr-xr-x@ 11 root wheel 374 Oct 23 10:27 ..
-rw-r--r-- 1 hongseongmin staff 6533120 Oct 30 14:53 apache-maven-3.1.1-bin.tar
drwxr-xr-x@ 14 hongseongmin staff 476 Oct 23 10:27 apache-tomcat-6.0.35
-rw-r--r--@ 1 hongseongmin staff 6697806 Jul 27 2012 apache-tomcat-6.0.35.tar.gz
drwxr-xr-x 13 root wheel 442 Oct 23 10:27 apache-tomcat-6.0.37
-rw-r--r--@ 1 hongseongmin staff 6885442 May 4 21:20 apache-tomcat-6.0.37.tar.gz
drwxr-xr-x 21 root wheel 714 Oct 23 10:27 bin
drwxr-xr-x 5 root wheel 170 Oct 23 10:27 include
drwxr-xrwx 23 root wheel 782 Oct 30 13:41 lib
drwxr-xr-x 8 root wheel 272 Oct 23 10:27 sbin
drwxr-xr-x 4 root wheel 136 Oct 23 10:27 share
hongseongmin-MacBook-Pro:local root# tar -zxvf apache-maven-3.1.1-bin.tar
4. 압축을 풀고 나서 향후 버전관리를 위해 심볼릭 링크 생성
hongseongmin-MacBook-Pro:local root# ln -s apache-maven-3.1.1 maven
hongseongmin-MacBook-Pro:local root# ls -al
total 39312
drwxr-xr-x 14 root wheel 476 Oct 30 14:57 .
drwxr-xr-x@ 11 root wheel 374 Oct 23 10:27 ..
drwxr-xr-x 9 root wheel 306 Oct 30 14:54 apache-maven-3.1.1
-rw-r--r-- 1 hongseongmin staff 6533120 Oct 30 14:53 apache-maven-3.1.1-bin.tar
drwxr-xr-x@ 14 hongseongmin staff 476 Oct 23 10:27 apache-tomcat-6.0.35
-rw-r--r--@ 1 hongseongmin staff 6697806 Jul 27 2012 apache-tomcat-6.0.35.tar.gz
drwxr-xr-x 13 root wheel 442 Oct 23 10:27 apache-tomcat-6.0.37
-rw-r--r--@ 1 hongseongmin staff 6885442 May 4 21:20 apache-tomcat-6.0.37.tar.gz
drwxr-xr-x 21 root wheel 714 Oct 23 10:27 bin
drwxr-xr-x 5 root wheel 170 Oct 23 10:27 include
drwxr-xrwx 23 root wheel 782 Oct 30 13:41 lib
lrwxr-xr-x 1 root wheel 18 Oct 30 14:57 maven -> apache-maven-3.1.1
drwxr-xr-x 8 root wheel 272 Oct 23 10:27 sbin
drwxr-xr-x 4 root wheel 136 Oct 23 10:27 share

Maven 환경 설정

설정 해야하는 환경 변수는 다음과 같습니다.
  • M3_HOME: MAVEN 3.0.1이 설치된 디렉터리 지정
  • JAVA_HOME:  JAVA 설치 디렉터리 지정
  • PATH: M2_HOME의 bin 디렉터리 Path 추가
.profile의 환경 변수를 설정하는 방식은 다음과 같습니다,
export M3_HOME=/usr/local/maven
export M3=$M3_HOME/bin
export PATH=$PATH:$M3
export JAVA_HOME=/Library/Java/Home

설치 확인

다음 두 명령어를 이력하여 설치 완료 여부를 체크 합니다.
  • mvn -version
  • mvn install

댓글 없음:

댓글 쓰기