Mac OSX 매버릭스에서 Maven을 찾을 수 없음
Mac OSX 10.8을 10.9로 업그레이드 한 후 Maven은 / usr / share 경로에서 찾을 수 없지만 10.8에 설치되었습니다.
이 명령을 시도 할 때 :
$ maven -version
이 결과를 얻었다
-bash : mvn : 명령을 찾을 수 없음
하지만 10.8에서 잘 작동합니까? 어떤 생각?
Maven은 Mac OS X 10.9에 기본적으로 더 이상 설치되지 않습니다. 예를 들어 Homebrew 를 사용하여 직접 설치해야합니다 .
maven을 설치하기 위해 homebrew (또는 다른 패키지 관리자)를 설치하지 않으려면 사이트에서 바이너리를 가져올 수 있습니다.
http://maven.apache.org/download.cgi
폴더 (예에 콘텐츠를 추출 /Applications/apache-maven-3.1.1
)과을
$ tar -xvf apache-maven-3.1.1-bin.tar.gz
마지막 ~/.bash_profile
으로 포함하려는 텍스트 편집기로 조정하십시오.
export M2_HOME=/Applications/apache-maven-3.1.1
export PATH=$PATH:$M2_HOME/bin
터미널을 다시 시작하고 테스트
$ mvn -version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 17:22:22+0200)
Maven home: /Applications/apache-maven-3.1.1
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: de_DE, platform encoding: MacRoman
OS name: "mac os x", version: "10.9", arch: "x86_64", family: "mac"
brew install maven
최신 Xcode 및 명령 줄 도구를 설치했는지 확인하십시오.
xcode-select --install
- 여기 에서 Maven을 다운로드 합니다 .
- 방금 다운로드 한 tar.gz를 원하는 위치 (예 : / Users / admin / Maven)에 추출합니다.
- 터미널을 엽니 다.
cd
홈 폴더로 이동하려면 " "을 입력 하십시오.- "
touch .bash_profile
"를 입력합니다 . - "
open -e .bash_profile
"를 입력 하여 TextEdit에서 .bash_profile을 엽니 다. - 텍스트 편집기에 다음을 입력하십시오.
alias mvn='/[Your file location]/apache-maven-x.x.x/bin/mvn'
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdkx.x.x_xx.jdk/Contents/Home/
(음성 표시 또는 아포스트로피가 없는지 확인하십시오.) 8. 필요한 데이터를 입력했는지 확인하십시오 (예 : 파일 위치 및 버전 번호).
- 변경 사항 저장
. .bash_profile
.bash_profile을 다시로드하고 추가하는 모든 기능을 업데이트하려면 " "을 입력 하십시오. (* 단일 공백으로 점을 구분해야합니다).- 유형
mvn -version
성공하면 다음이 표시됩니다.
Apache Maven 3.1.1
Maven home: /Users/admin/Maven/apache-maven-3.1.1
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.1", arch: "x86_64", family: "mac"
이 솔루션은 매우 길어 보일 수 있지만 . 모든 것이 명확하도록 많은 예를 포함했습니다. Mavericks OS에서 저에게 효과적이었습니다.
참고 : 위에 표시된 답변 중 일부를 결합 및 편집하고 몇 가지 예와 형식을 추가하고 결과를 게시 했으므로 크레딧은 대부분 원본 게시물의 작성자에게 제공됩니다.
터미널을 엽니 다.
수동으로 또는 터미널에 다음 줄을 입력하여 원하는 위치에 방금 다운로드 한 파일을 추출합니다 (필요한 데이터 입력).
mv [Your file name] [Destination location]/ tar -xvf [Your file name]
예를 들어 파일 이름이 "
apache-maven-3.2.1-bin.tar
"(Maven 버전 3.2.1 )이고 "/Applications
"디렉토리 에서 찾으려면 터미널에 다음 줄을 입력해야합니다.mv apache-maven-3.2.1-bin.tar /Applications/ tar -xvf apache-maven-3.2.1-bin.tar
If you don't have any JDK (Java Development Kit) installed on your computer, install one.
Type "
java -version
" in Terminal. You should see something like this:java version "1.8.0" Java(TM) SE Runtime Environment (build 1.8.0-b132) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b70, mixed mode)
Remember your java version (in the example, 1.8.0).
Type "
cd ~/
" to go to your home folder.Type "
touch .bash_profile
".Type "
open -e .bash_profile
" to open .bash_profile in TextEdit.Type the following in TextEdit (copy everything and replace the required data):
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk[Your Java version].jdk/Contents/Home export M2_HOME=[Your file location]/apache-maven-[Your Maven version]/ export PATH=$PATH:$M2_HOME/bin alias mvn='$M2_HOME/bin/mvn'
For example, in our case we would replace "
[Your Java version]
" with "1.8.0
" (value got in step 5), "[Your file location]
" with "/Applications
" (value used as "Destination Location" in step 3) and "[Your Maven version]
" with "3.2.1
" (Maven version observed in step 3), resulting in the following code:export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home export M2_HOME=/Applications/apache-maven-3.2.1/ export PATH=$PATH:$M2_HOME/bin alias mvn='$M2_HOME/bin/mvn'
Save your changes
Type "
source .bash_profile
" to reload .bash_profile and update any functions you add.Type
mvn -version
. If successful you should see the following:Apache Maven [Your Maven version] ([Some weird stuff. Don't worry about this]) Maven home: [Your file location]/apache-maven-[Your Maven version] Java version: [You Java version], vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk[Your Java version].jdk/Contents/Home/jre [Some other stuff which may vary depending on the configuration and the OS of the computer]
In our example, the result would be the following:
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00) Maven home: /Applications/apache-maven-3.2.1 Java version: 1.8.0, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0</b>.jdk/Contents/Home/jre Default locale: es_ES, platform encoding: UTF-8 OS name: "mac os x", version: "10.9.2", arch: "x86_64", family: "mac"
I am not allowed to comment to pkyeck's response which did not work for a few people including me, so I am adding a separate comment in continuation to his response:
Basically try to add the variable which he has mentioned in the .profile file if the .bash_profile did not work. It is located in your home directory and then restart the terminal. that got it working for me.
The obvious blocker would be that you do not have an access to edit the .profile file, for which use the "touch" to check the access and the "sudo" command to get the access
-
touch .profile
-
vi .profile
Here are the variable pkyeck suggests that we added as a solution which worked with editing .profile for me:
-
export M2_HOME=/apache-maven-3.3.3
-
export PATH=$PATH:$M2_HOME/bin
참고URL : https://stackoverflow.com/questions/19678594/maven-not-found-in-mac-osx-mavericks
'program tip' 카테고리의 다른 글
드롭 다운 상자에서 텍스트 가져 오기 (0) | 2020.10.29 |
---|---|
Unix (또는 Windows)에서 (이름없는) 파이프를 사용하여 한 프로세스의 표준 출력을 여러 프로세스로 어떻게 보낼 수 있습니까? (0) | 2020.10.29 |
UIApplication.registerForRemoteNotifications ()는 메인 스레드에서만 호출되어야합니다. (0) | 2020.10.28 |
파이썬 목록에서 중복을 제거하고 순서를 유지하는 방법은 무엇입니까? (0) | 2020.10.28 |
현재 컨텍스트에 'controlname'이름이 없습니다. (0) | 2020.10.28 |