
메이븐(maven)을 사용해보자.
http://maven.apache.org/
아파치 메이븐은 소프트웨어 프로젝트 관리, comprehension 도구이다.
POM(Project Object Model)의 개념을 기반으로 한 메이븐은 프로젝트의 빌드와 리포트와 문서의 관리를
돕는다.
메이븐은..
- 빌드 과정을 쉽고, 동일하게
- 높은 수준의 프로젝트 정보를 제공하고
- 개발의 best practice의 가이드라인을 제공하며
- 새로운 기능에 투명한 마이그레이션을 허락해.
태현씨 말로는 프로젝트에 대해서 라이브러리의 추가 등 이런저런 변경사항이 생긴 경우
변경된 pom.xml파일만 팀원 들간에 공유하면 되므로 굉장히 편하대.
각종 라이브러리를 메이븐 레파지토리를 통해서 다운받아서 로컬 레파지토리에 저장해서 사용한대.
계속해서 다음 과정을 알아보지 머.
1. 메이븐 설치
2. 샘플 프로젝트 생성 및 컴파일
3. 이클립스에 붙이기
1. 메이븐 설치
2. 샘플 프로젝트 생성 및 컴파일
3. 이클립스에 붙이기
메이븐 설치
- jdk가 깔려있어야해.
- http://maven.apache.org/download.html 로부터 최신버전 다운로드 및 적절한 경로에 압축해제.
- 환경변수 M2_HOME을 만들고 maven 압축 푼 디렉토리로 지정.
- 환경변수 path에 %M2_HOME%\bin 추가.
- 커맨드 창에서 작동여부를 확인한다.
(각 OS별 설치 방법은 http://maven.apache.org/download.html#Installation 링크에 나와있어)
C:\Documents and Settings\greesp>mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-07 04:16:01+0900)
Java version: 1.6.0_16
Java home: C:\Java\jdk1.6.0_16\jre
Default locale: ko_KR, platform encoding: MS949
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
프로젝트 생성 및 컴파일 (참고url)
> mvn archetype:create -DgroupId=com.nushirt.app -DartifactId=guestbook
이 명령어를 실행한 디렉토리에 프로젝트가 생성되는데 적절한 경로에서 실행하는게 좋겠다.
실행하면 해당 디렉토리에 샘플코드가 들어있는 src폴더와 pom.xml이 생성된다.
> mvn package
결과로는 target 폴더가 생기면서 컴파일된 결과와 .jar파일이 생성돼.
실행해보면..
> java -cp target/guestbook-1.0-SNAPSHOT.jar com.nushirt.app.AppHello World!
Running Maven Tools
메이븐의 단계들.. 억지로 한국말로 바꾸는 것도 지겹..
Although hardly a comprehensive list, these are the most common default lifecycle phases executed.
- validate: validate the project is correct and all necessary information is available
- compile: compile the source code of the project
- test: test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
- package: take the compiled code and package it in its distributable format, such as a JAR.
- integration-test: process and deploy the package if necessary into an environment where integration tests can be run
- verify: run any checks to verify the package is valid and meets quality criteria
- install: install the package into the local repository, for use as a dependency in other projects locally
- deploy: done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
There are two other Maven lifecycles of note beyond the default list above. They are
- clean: cleans up artifacts created by prior builds
- site: generates site documentation for this project
> mvn compile
이런 식으로 각 단계를 실행해. 단, 해당 단계의 이전 단계들을 선행한 후에 실행한대.
이클립스에 붙이기(참고url)
> mvn eclipse:eclipse
위 명령어를 실행하면 해당 프로젝트 폴더에 이클립스 설정 xml파일인 .classpath와 .project파일이 생기
므로 이클립스의 import > Existing Projects into Workspace 메뉴로 쉽게 임포트가 되겠네.
여기까지하면 생성된 프로젝트는 일단 에러가 발생할 것이야.
메이븐 로컬 repository경로를 몰라서 나는 에러이므로 M2_REPO라는 classpath변수가 설정해야해.
이클립스를 실행하여 다음과 같이 실행해서 M2_REPO변수를 추가하자.
Window > Preferences > Java > Build Path > Classpath
메이븐 로컬 repository경로는 C:\Documents and Settings\xxxx\.m2\repository 이런곳에 있네.
댓글을 달아 주세요
댓글 RSS 주소 : http://kk67547.cafe24.com/blog/rss/comment/132메이븐 + 플렉스 + 스프링 + iBATIS로 간단한 방명록이나 만들어봐야지.
통.. 코딩을 안하니깐 공부해도 다 까먹고 있어.
I do not know if it's just me or if everyone else experiencing
problems with your site. It appears as if
some of the text within your content are running off the screen.
Can someone else please provide feedback and let me know if this is happening to them as well?
This might be a problem with my browser because
I've had this happen before. Kudos