2014년 3월 3일 월요일

Maven - LifeCycle

LifeCycle

Maven - POM.xml Build태그

POM.xml Build 태그

Spring - 스프링을 더 강력하게 해주는 아이들

- aspectj : Pointcut, Advice, Advisor(Spring AOP를 더 쉽고 강력하게!)

- aopalliance : AOP를 사용하기 위해 필요한 라이브러리(메서드 실행 전, 후 도는 예외발생 시점에 공통기능을 실행할 수 있다. )

- jsr250-api : Resource 어노테이션을 사용가능하게 해준다.

egovframework - egovframework.rte.fdl.cmmn과 egovgramework.rte.ptl.mvc의 구성

<egovframework.rte.fdl.cmmn>

  - AbstractServiceImpl : 전자정부 공통 예외(EgovBizException) 발생, 예외 트레이스 정보 출력 

  - ExceptionTransfer : 예외 유형별 예외 후 처리 기능 제공

  - BaseException : 예외 상속구조의 최상단

  - EgovBizException : 서비스 레이어에서 발생시키는 비지니스 예외(BaseException 하위 클래스)

  - FdlException : 전자정부 표준 예외 클래스(BaseException 하위 클래스)

  - ExceptionHandler : AbsExeptionHandleManager, 또는 그 하위 클래스에서 예외처리 목적으로 호출

  - ExeptionHandlerService : ExceptionTransfer에서 호출 됨

  - DefaultExeption : ExceptionHandlerService의 기본 구현체, AbsExeptionHandleManager를 상속함, 일치하는 패턴이 있는 경우 ExceptionHandler.occur() 호출

  - AbsExeptionHandleManager : ExceptionHandlerService에 기본 기능 제공

<egovframework.rte.ptl.mvc>

 - CommandMapArgumentResolver : 스프링의 WebArgumentResolver를 구현

 - HTMLTagFilter : 서블릿 필터의 구현체(ServletRequest를 HTMLTagFilterRequestWrapper로 레핑하여 반환

 - HTMLTagFilterRequestWrapper : HttpServletRequestWrapper를 상속하여 구현(파라미터 처리를 확장한 몇 개의 메소드 제공, 파라미터 값 중 문제가 되는 문자('<', '\' 등)을 표현식으로 변환하여 반환하는 기능 제공

 - SimpleUrlAnnotationHandlerMapping : URL 별 Interceptor등록 지원

 - PaginationTag : 페이징 처리를 지원하는 Tag, 실제 페이징 처리는 PaginationManager에서 제공하며, 런타임 시에 DL방식으로 해당 빈을 룩업해 옴. 없을 경우 DefalutPaginationMapper 사용

 - PaginationManager : 다수의 PaginationRenderer를 런타임 시에 type에 따라 획득하여 사용할 수 있는 구조를 제공

 - PaginationRenderer : 실제 페이지 관련 화면 로직을 수행하며, 기본 구현체로 DefaultPaginationRenderer를 제공

 - RteFieldChecks : 아파치 커먼스 Validator를 확장하여 주민번호 체크 등의 기능 제공


 - RteGenericValidator : 유효성 검증 기능을 제공하는 static 메소드 제공

Maven - 이클립스 Maven 연동 시 plug in 에러 날 경우

Multiple annotations found at this line:
- Execution default-testResources of goal org.apache.maven.plugins:maven-resources-          plugin:2.4.3:testResources failed: 
 Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to collect 
 dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 () (org.apache.maven.plugins:maven-resources-
 plugin:2.4.3:testResources:default-testResources:process-test-resources)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile 
 (execution: default-compile, phase: compile)
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: 
 PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be 
 resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 (): 
 ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6: 
 ArtifactResolutionException: Failure to transfer org.apache.maven:maven-plugin-api:pom:2.0.6 from http://repo1.maven.org/
 maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or 
 updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (http://
 repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-
 api-2.0.6.pom
- CoreException: Could not get the value for parameter compilerId for plugin execution default-testCompile: 
 PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be 
 resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 (): 
 ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven:maven-plugin-api:jar:2.0.6: 
 ArtifactResolutionException: Failure to transfer org.apache.maven:maven-plugin-api:pom:2.0.6 from http://repo1.maven.org/
 maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or 
 updates are forced. Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:pom:2.0.6 from/to central (http://
 repo1.maven.org/maven2): null to http://repo1.maven.org/maven2/org/apache/maven/maven-plugin-api/2.0.6/maven-plugin-
 api-2.0.6.pom
- Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources failed: Plugin 
 org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to collect 
 dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 () (org.apache.maven.plugins:maven-resources-
 plugin:2.4.3:resources:default-resources:process-resources)
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:
 2.3.2:testCompile (execution: default-testCompile, phase: test-compile)
대략 이런 에러가 발생했을 경우.
POM.xml을 확인해보면
<project xmlns="http://maven.apache.org/POM/4.0.0"                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.lala.sarasa</groupId>
   <artifactId>msrdecision</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>msrdecision Maven Webapp</name>
  <url>http://maven.apache.org</url>
 <dependencies>
   <dependency>
     <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>hello</finalName>
   </build>
 </project>
이렇게 되어 있을 것이고, 해결방법은 POM.xml에
<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.4.3</version>
</dependency>
이런식으로 디펜던시를 추가해주면 된다.(현재 날짜 기준으로 최신버전인 3.2.1은 되지 않는다.)
이렇게 작성해준 뒤에, 
1. 프로젝트 우클릭 > Run As > Maven Install
2. 이클립스 프로젝트 탐색기에서 해당 프로젝트 클릭 후 F5(새로고침)
3. 프로젝트 우클릭 > Maven > Update Project 
끝!