2012년 6월 27일 수요일

Maven-WTP Project 생성 순서

Eclipse에 Maven Plugin 설치
(URL은 추후에 추가하도록 하자)
1. Maven Integration for Eclipse
  - m2e - Maven Integration for Eclipse
  - m2e - slf4j over logback logging (option)
2. Maven Integration for Eclipse Extras
  - m2e connector for mavenarchiver pom properties
3. Maven Integration for Eclipse WTP
   - Maven Integration for WTP (Optional)
4. Maven Integration for WTP
   - Maven Integration for WTP


* 위에서 없어도 되는 게 있을 텐데, 하나씩 빼면서 해 볼 수도 없고



Project 생성
File -> New -> Other -> Maven -> Maven Project

New Maven project
Select project name and location
   * Use default Workspace location [선택] 후
   * Next

Select an Archetype
   * Catalog : Internal
   * Filter : webapp
    선택:
    Group Id: org.apache.maven.archetypes
    Artifact Id: maven-archetype-webapp

   * Next

Enter Artifact Id
   * Group Id: hnj.webapps [project 구분 id]
   * artifact id: scada [project name]
   * package: [project source package]

    * Finish

위의 과정을 거치면 artifact id로 넣었던 scada라는 이름의 project가 package explorer에 나타남
[pic-1][아래는 spring perspective]

[pic-2][아래는 Java EE perspective]

[pic-3][아래 Directory까지 추한한 후 Navigator로 본 구조]

Project 설정 변경
- src/main/webapps/WEB-INF/web.xml을 삭제
Project -> Project Facets

* Dynamic Web Module Check 해제 후 Apply
* 적당한 Dynamic Web Module의 버전 선택
Dynamic Web Module Check
* 하단: Further configuration available
context root: scada [project name]
content directory: /src/main/webapp
- generation web.xml을 선택
* OK


- 추가후 compler에서 보여지는 오류가 있다면
  - web-module 3.0
  - java-version 1.6
을 선택 하면, java version mismatch가 나옴
  - projects-properties
     Java Compiler의 java 버전 맞춤
- 그래도 남는 Maven 관련 오류
     "Dynamic Web Module 3.0 requires Java 1.6 or newer."
    pom.xml 편집

    <build>
<finalName>scada</finalName>
<!-- Dynamic Web Module 3.0 requires Java 1.6 or newer -->
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
<!-- Dynamic Web Module 3.0 requires Java 1.6 or newer -->
     </build>

     maven update를 수행

Project에 Directory 추가
src/main/java
src/main/resources


src/test/java
src/test/resources

와 같이 디렉토리 생성

추가한 directory를 deploy항목에 추가
xml파일 편집 또는 properties에서 설정
- .settings/org.eclipse.wst.common.component를 편집
또는
- Properties -> Deployment Assembly
에 추가

.classpath를 편집하거나 properties에서 설정
- .classpath
- Properties -> Java Build Path -> Source


maven update
maven install


댓글 없음:

댓글 쓰기