eclipse & maven




맨날 터미널에서 php만 쓰다가 이클립스랑 메이븐 셋팅하려니 죽겠다 ^,^..



한 2일은 헤맨듯.. ㅠㅠㅠㅠㅠ 자괴감 들어..



나중을 위해 정리..



가장 중요한건 메이븐 설치 환경변수..



예전에 자바를 설치해놓고 셋팅해놨는데 왜인지 JAVA_HOME 셋팅해둔게 날아감?



그런데 터미널에서 java & javac 동작은 잘 되었었단 말이지.. 신기방기..



아무튼, Path가 이상하니 maven 이 덩달아 안되었었다.



maven 패스를 잡고나서 Setting.xml 을 확인했는데, 처음 디폴트 경로가



c\users\alice\settings.xml 이었고, 여기에 settings.xml 은 없었음.



그래서 maven 하위의 conf/settingx.xml 로 경로를 수정하고 프로젝트 업데이트 되면서



에러가 나지 않았음.





1. Download maven: https://maven.apache.org/download.cgi



2. Unzip maven file( my path: D:\apache-maven-3.3.9 )



3. Configure system variable

   (add) MAVEN_HOME : D:\apache-maven-3.3.9

   (modify) Path: {blah blah legacy path};D:\apache-maven-3.3.9\bin;



4. Check maven at terminal

   C:\Users\alice>mvn --version

        Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T01:41:47+09:00)

        Maven home: D:\apache-maven-3.3.9\bin\..

        Java version: 1.8.0_40, vendor: Oracle Corporation

        Java home: C:\Program Files\Java\jdk1.8.0_40\jre

        Default locale: ko_KR, platform encoding: MS949

        OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"



5. Eclipse setting

   Window - Preference - Maven - User Setting

   User Settings: D:\apache-maven-3.3.9\conf\settings.xml

   -> {Your maven home dir}\settings.xml



6. Creating maven simple project

   File - New - Project - Maven - Maven Project



--------------------------------------



About trouble shooting



Following 2 errors are what I saw when I was setting maven.......



Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved





Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.4 or one of its dependencies could not be resolved





1. Check path of system variables(MAVEN_HOME & Path) is correct



2. Run mvn command at terminal to check your system recognizes that command



3. Check your Setting.xml is exist

   Window - Preference - Maven - User Setting



   If it generates errors still, despite you changed and applied the Setting.xml path,

   remove the directory of .m2.



   You can find .m2 directory below:

   Window - Preference - Maven - User Setting - Local Repository



   Refresh your project.

   Right click on your project - Refresh



    You can realize the new .m2 directory is created again.

댓글