블로그 이미지
올해목표 // 10월 어학연수 떠나자~ 자수씨

카테고리

전체글 (1457)
Brand New! (28)
주절주절 (213)
MOT (11)
해외쇼핑 (49)
쇼핑노트 (150)
취미생활 (94)
iPhone (4)
Eclipse (121)
Google (83)
Spring (31)
JAVA (176)
JavaScript (59)
WEB (49)
Database (20)
OS (26)
Tools (8)
Tips (26)
IT정보 (1)
Book (21)
Programming (37)
외부행사 (43)
주변인들 (17)
여행노트 (60)
학교생활 (30)
회사생활 (52)
사회생활 (5)
외국어공부 (12)
잡동사니 (30)
Total
Today
Yesterday
 
04-26 07:42
 

달력

« » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
 

최근에 올라온 글

최근에 달린 댓글

Recently came across this the existance of the -DskipTests argument while running maven.

From the userguide:

You can also skip the tests via command line by executing the following command:

mvn install -DskipTests

If you absolutely must, you can also use the maven.test.skip property to skip compiling the tests. maven.test.skip is honored by Surefire, Failsafe and the Compiler Plugin.

mvn install -Dmaven.test.skip=true

Skiptests is a feature of surefire, while -Dmaven.test.skip is a feature of maven itself.


일단 스크랩... 나중에 정리해야지...


참고자료

http://www.inze.be/andries/2011/05/11/maven-difference-between-dskiptests-and-dmaven-test-skiptrue/


Posted by 자수씨
, |

지난번에 한번 포스팅(m2eclipse Run 메뉴 수정~)을 했었던 m2eclipse 의 Run 메뉴 팝업 확장법을 공개합니다.




m2eclipse 플러그인 확인

우선 현재 설치되어 있는 m2eclipse 플러그인을 확인합니다.

[ECLIPSE_HOME]/plugins
 └ ...
 └ org.maven.ide.eclipse.editor.xml_0.12.1.20110112-1712.jar
 └ org.maven.ide.eclipse.editor_0.12.1.20110112-1712.jar
 └ org.maven.ide.eclipse.jdt_0.12.1.20110112-1712.jar
 └ org.maven.ide.eclipse.launching_0.12.1.20110112-1712.jar
 └ org.maven.ide.eclipse.maven_model_edit_0.12.1.20110112-1712.jar

 └ ...

저는 어제 (2011-09-28) 재설치를 했는데, 0.12.1.20110112-1712 버전이 설치되어 있었습니다.


플러그인 수정

org.maven.ide.eclipse.launching_0.12.1.20110112-1712.jar 파일의 압축을 해제합니다.

[ECLIPSE_HOME]/plugins/org.maven.ide.eclipse.launching_0.12.1.20110112-1712.jar
 └ icons
 └ META-INF
 └ org
 └ org.maven.ide.eclipse.cliresolver.jar
 └ org.maven.ide.eclipse.cliresolver30.jar

 └ plugin.properties
 └ plugin.xml



plugin.properties 파일에 아래의 내용을 추가합니다.

plugin.properties
...
m2.popup.lifecycle.cleanAndPackage=Maven clean and package
m2.popup.lifecycle.cleanAndInstall=Maven clean and install
m2.popup.lifecycle.cleanAndDeploy=Maven clean and deploy



메뉴 팝업을 확장하기 위해 plugin.xml 을 수정합니다.

plugin.xml




다시 jar 압축을 묶고 이클립스를 실행하면... 바로 반영이 되지 않습니다.
이전 버전의 이클립스에서는 바로 반영이 되었는데, 플러그인 로딩방식이 바뀌었거나 m2eclipse 에서 캐싱을 하는지 바로 반영이 되지 않습니다.

해결방법은 다음과 같습니다.
1. org.maven.ide.eclipse.launching_0.12.1.20110112-1712.jar 파일을 다른 곳으로 옮겨둔 후 이클립스 실행
2. Run 메뉴에서 maven 관련 메뉴가 빠진 것을 확인
3. org.maven.ide.eclipse.launching_0.12.1.20110112-1712.jar 파일을 복구한 후 이클립스 실행



반복작업을 줄여줄 수 있어서 좋네요~ 쿠헤헤

Posted by 자수씨
, |

다중 프로젝트의 디펜던시 버전 관리

다중 프로젝트를 사용할 경우 디펜던시의 버전 번호를 각각의 pom.xml 파일에 정의하여 설정하여, 새로운 버전으로 업그레이드가 이루어질 경우 모든 pom.xml 을 변경해야 합니다.

메이븐에서는 <dependencyManagement> 엘리먼트를 통하여 디펜던시 버전 번호를 병합할 수 있는 방안을 제공합니다.

부모 POM 에서 <dependencyManagement> 정의를 통해 자식 POM 에서 버전을 명기하지 않아도 디펜던시를 참조할 수 있습니다.

메이븐은 <dependencyManagement> 엘리먼트를 정의한 프로젝트를 찾을 때까지 자식 프로젝트에서 부모 프로젝트까지 확인합니다.


예제

부모 POM의 종송성 버전 정의

자식 프로젝트 POM



위와같이 자식 프로젝트에 버전을 명시하지 않아도 부모 POM <dependencyManagement> 엘리먼트에서 정의되었기 때문에, 자식 프로젝트의 spring-data-jpa 디펜던시의 버전 번호가 전달됩니다.


결론적으로 <dependencyManagement> 엘리먼트는 버전 번호를 지정하지 않아도 어느 하위 프로젝트라도 디펜던시를 정의할 수 있도록 해주는 환경변수와 같습니다.

모든 프로젝트에서 사용하는 디펜던시라면 부모 POM 에서 정의하여 사용하는 것이 훨씬 관리에 용이합니다.

참고자료

Maven, Sonatype이 만든 Maven 핵심 가이드 (팀 오브라이언 지음 / 장선진 옮김)

Posted by 자수씨
, |

clean 하고 package, install, deploy 하는 작업이 귀찮아서... 플러그인 수정했슴돠...





ㅋㅋㅋ

Posted by 자수씨
, |

윈도우 기준, %MAVEN_HOME%\bin\mvn.bat 를 수정합니다.

...
@REM Start MAVEN2
:runm2
set CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
set MAVEN_OPTS="-XX:MaxPermSize=364m"
%MAVEN_JAVA_EXE% %MAVEN_OPTS% -classpath %CLASSWORLDS_JAR% "-Dclassworlds.conf=%M2_HOME%\bin\m2.conf" "-Dmaven.home=%M2_HOME%" %CLASSWORLDS_LAUNCHER% %MAVEN_CMD_LINE_ARGS%
if ERRORLEVEL 1 goto error
goto end
...

heap size 문제가 발생하면 -Xmx=512m 정도로 설정해주면 될 듯하네요~



Posted by 자수씨
, |

메이븐을 이용하여 기본적으로 제공해주는 webapp archetype 으로 프로젝트를 생성하게 되면 이클립스에서 웹 프로젝트로 인식이 되지 않습니다.

프로젝트도 아래와 같이 단순하게 구성되어 있습니다.



pom.xml 에 wtp 와 관련된 plugin 설정을 합니다.



그런 후에 eclipse:eclipse 를 goal 로 빌드를 하게 되면~




[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building gwtbuilder-webapp Maven Webapp
[INFO]    task-segment: [eclipse:eclipse]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing eclipse:eclipse
[INFO] No goals needed for project - skipping
[INFO] [eclipse:eclipse {execution: default-cli}]
[INFO] Adding support for WTP version 2.0.
[INFO] Using Eclipse Workspace: D:\**********
[INFO] no substring wtp server match.
[INFO] Using as WTP server : Tomcat v6.0 as wiseOne
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER
[INFO] @@@ TRUE - Manifests are equal
[INFO] Not writing Manifest file as it is unchanged: D:\**********\gwtbuilder-webapp\src\main\webapp\META-INF\MANIFEST.MF
[INFO] File D:\**********\gwtbuilder-webapp\.project already exists.
       Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be removed.
[INFO] Wrote Eclipse project for "gwtbuilder-webapp-0.0.1-SNAPSHOT" to D:\**********\gwtbuilder-webapp.
[INFO]
       Sources for some artifacts are not available.
       Please run the same goal with the -DdownloadSources=true parameter in order to check remote repositories for sources.
       List of artifacts without a source archive:
         o junit:junit:3.8.1
       Javadoc for some artifacts is not available.
       Please run the same goal with the -DdownloadJavadocs=true parameter in order to check remote repositories for javadoc.
       List of artifacts without a javadoc archive:
         o junit:junit:3.8.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Wed Jan 12 16:09:35 KST 2011
[INFO] Final Memory: 8M/19M

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building gwtbuilder-webapp Maven Webapp
[INFO]    task-segment: [eclipse:eclipse]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing eclipse:eclipse
[INFO] No goals needed for project - skipping
[INFO] [eclipse:eclipse {execution: default-cli}]
[INFO] Adding support for WTP version 2.0.
[INFO] Using Eclipse Workspace: D:\**********
[INFO] no substring wtp server match.
[INFO] Using as WTP server : Tomcat v6.0 as *******
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER
[INFO] File D:\**********\gwtbuilder-webapp\.project already exists.
       Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be removed.
[INFO] Wrote Eclipse project for "gwtbuilder-webapp-0.0.1-SNAPSHOT" to D:\**********\gwtbuilder-webapp.
[INFO]
       Sources for some artifacts are not available.
       Please run the same goal with the -DdownloadSources=true parameter in order to check remote repositories for sources.
       List of artifacts without a source archive:
         o junit:junit:3.8.1
       Javadoc for some artifacts is not available.
       Please run the same goal with the -DdownloadJavadocs=true parameter in order to check remote repositories for javadoc.
       List of artifacts without a javadoc archive:
         o junit:junit:3.8.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Wed Jan 12 16:27:06 KST 2011
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------



웹 프로젝트와 관련된 설정들이 추가되게 됩니다.




이제 개발 고고씽~

Posted by 자수씨
, |

메이븐을 쓰면서도 Ant 를 이용하여 빌드하는 경우도 발생할 수 있습니다.

이 때 좀 애매한 상황이 클래스패스 설정 부분일 것 입니다.

이런 상황에서 원하는 기능을 제공해 주는 것이 있습니다. Maven Ant Tasks (http://maven.apache.org/ant-tasks/index.html)

아래 페이지에서 관련 라이브러리를 받은 후에 ant 에 task 를 추가합니다.
http://maven.apache.org/ant-tasks/download.html 




사용법은 아래와 같습니다.



Ant 클래스패스를 정의한 후에 자바 프로그램을 실행하거나 컴파일을 할 때 패스를 지정하여 사용합니다.

라이브러리를 확인하는 절차 때문에 초기 실행에 시간이 약간 걸리지만 Maven 과 Ant 를 함께 잘 어울려서 쓸수 있는 방법 중 하나인 것 같습니다.

Posted by 자수씨
, |

MANIFEST.MF 파일을 커스터마이징 하기 위해서는 maven-jar-plugin 을 이용합니다.
(http://maven.apache.org/plugins/maven-jar-plugin)

사용법은 아래와 같습니다.




전체적인 MANIFEST 설정은 아래의 구조를 갖습니다. (http://maven.apache.org/shared/maven-archiver/index.html)



addClasspath 설정을 하면 알아서 메이븐 디펜던시를 추가해줍니다. 참편하네요~

Posted by 자수씨
, |

글 보관함

최근에 받은 트랙백