■ 개발 환경별로 spring설정 파일을 달리하기 위한 profile설정을 정리한다. 로컬에서 개발하기 위한 local과 개발 서버에서 검증하기 위한 dev을 설정한다. maven.test.skip는 빌드시에 junit테스트 여부를 지정하고 activeByDefault는 profile 옵션을 지정하지 않았을 경우에 기본 빌드 옵션을 지정한다.
<project> ... <profiles> <profile> <id>local</id> <properties> <maven.test.skip>false</maven.test.skip> <deploy.phase>local</deploy.phase> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> <profile> <id>dev</id> <properties> <maven.test.skip>false</maven.test.skip> <deploy.phase>dev</deploy.phase> </properties> </profile> </profiles> ... </project>
■ resource설정 부분에는 아래 4가지 resource설정부분이 있는데 첫번째는 java source관련 설정, 주석 처리한 2번째는 기본 pom.xml 설정인데 주석처리를 하지 않으면 전체 resource가 target에 복사된다. 필히 주석처리를 하여야 한다. 3번째는 빌드 환경별(local/dev) 설정을 분리했고 4번째는 빌드환경별 속성정보를 분리했다.
<build> ... <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> </resource> <!-- <resource> <directory>src/main/resources</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> <include>**/*.setting</include> </includes> </resource> --> <resource> <directory>src/main/resources/${deploy.phase}</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> <include>**/*.setting</include> </includes> </resource> <resource> <directory>src/main/resources/properties/${deploy.phase}</directory> <includes> <include>**/*.properties</include> </includes> </resource> </resources> ... </build>
■ 개발환경별 빌드를 하기 위한 maven 설정 옵션은 -P local 처럼 아래와 같이 이클립스에서 변경 후 실행하면 된다.
- Tomcat 시작시 ServletContextListener를 통한 mySQL 접속 2018년 5월 8일
- spring mybatis mysql 연결 예제 2018년 5월 4일
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 2017년 12월 4일
- maven filtering – 메이븐 필터링 2016년 10월 24일
- maven profiles – 개발/운영 환경별 빌드 2016년 10월 24일
- maven pom.xml에서 로그 출력하기 2016년 5월 30일
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 2016년 5월 2일
- JUnit Controller Test java.lang.NoClassDefFoundError: javax/servlet/SessionCookieConfig 2016년 3월 22일
- Maven skipTests – Maven JUnit 테스트 안하기 2016년 3월 18일
- maven compile option -Xlint:deprecation 2016년 3월 17일
- Maven encoding 2016년 3월 17일
- TIBCO ActiveSpace Eclipse Maven 2016년 3월 16일
- Jetty Maven Plugin 2016년 3월 9일
- java.lang.UnsupportedClassVersionError: org/eclipse/jetty/maven/plugin/JettyRunMojo : Unsupported major.minor version 52.0 2016년 3월 9일
- java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet 2016년 2월 19일
- eclipse maven 디버그(debug) 모드로 빌드 2014년 11월 21일
- No Spring WebApplicationInitializer types detected on classpath 에러 2014년 11월 21일
- org.apache.ibatis.binding.BindingException 디버깅 2014년 11월 11일
- maven-war-plugin webXml, 개발 환경별 web.xml 관리 2014년 11월 10일
- 명령행 모드 메이븐 프로젝트 생성하기 2014년 9월 17일
- eclipse maven tomcat 자동 재시작 2014년 9월 13일