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

카테고리

전체글 (1457)
Brand New! (28)
주절주절 (213)
MOT (11)
해외쇼핑 (49)
쇼핑노트 (150)
취미생활 (94)
iPhone (4)
Eclipse (121)
Google (83)
Spring (31)
JAVA (176)
Ant (2)
Maven (29)
iBATIS (7)
Regular Expression (6)
Java Web Start (4)
WebServices (14)
JAXB (12)
CAS (13)
JBoss Seam (6)
OSGi (1)
Hibernate (2)
James (6)
Alfresco (17)
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-27 13:59
 

달력

« » 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 자수씨
, |


저희 조직에서는 메이븐 리파지토리로 유명한 Sonatype Nexus 를 사용하고 있습니다.

처음에 설정하기 귀찮아서 모든 사용자에게 Administrator 권한을 주었는데, 간혹가다 deploy 한 후 배포물을 삭제하는 경우가 있었습니다. 별 문제 없이 지나가다가 운영서버 배포 시ㅔ 같은 버전의 다른 배포물로 인해 재대로 반영이 되지 않는 문제가 발생하여 배포물에 대해 삭제를 하지 못하도록 권한을 설정하였습니다.

새로운 Role 을 만들고 아래와 같이 권한을 설정합니다.

  • Nexus Anonymous Role
  • Nexus Developer Role
  • All Repositories - (view)
  • All Repositories - (update)
  • All Repositories - (create)
  • All Repositories - (read)




처음에는 "All Repositories - (update)" 를 빼고 권한을 부여했더니, jar 파일은 올라가는데 나머지 pom 파일이나 sources.jar 파일이 올라가지 않아 update 권한도 추가하니 정상적으로 deploy 가 됩니다.


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-jar-plugin 프로젝트 페이지에 있는 http://maven.apache.org/plugins/maven-jar-plugin/usage.html 를 참조하여 아래와 같이 작성하였으나 재대로 파일이 필터링이 되지 않습니다.

패키징 시에 conf/config.properties 를 빼려고 하였으나...

<project>
  ...
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3.1</version>
        <configuration>
          <includes>
            <include>**/config.properties</include>
          </includes>
        </configuration>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>



계속 테스트를 하고 자료를 찾다보니, maven-jar-plugin 버전을 2.3 으로 처리한 것을 발견하여 버전만 바꾸니... 잘됩니다.


<project>
  ...
  <build>
    <plugins>
      ...
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.3</version>
        ...
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>



끙;;; 도대체 뭥미...



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 와 비교하는 표를 발견하였습니다.
(http://maven.apache.org/plugins/maven-antrun-plugin/usage.html)

Ant Expression Maven Expression
Built-in Tasks  
Ant maven-antrun-plugin
AntCall maven-antrun-plugin
Available profiles
BUnzip2 maven-assembly-plugin
BZip2 maven-assembly-plugin
Chmod maven-assembly-plugin
Condition profiles
Copy maven-resources-plugin
Dependset maven-dependency-plugin
Ear maven-ear-plugin
Filter maven-resources-plugin
Note: Filter uses the @...@ token while maven-resources-plugin uses the \$... token
FixCRLF maven-resources-plugin
GenKey maven-jar-plugin
GUnzip maven-assembly-plugin
GZip maven-assembly-plugin
Jar maven-jar-plugin
Javac maven-compiler-plugin
Javadoc/Javadoc2 maven-javadoc-plugin
LoadProperties maven-resources-plugin
Manifest maven-jar-plugin
Property maven-resources-plugin
Replace maven-resources-plugin
Note: Replace can specify its token while maven-resources-plugin uses the \$... token
Tar maven-assembly-plugin
Unjar maven-assembly-plugin
Untar maven-assembly-plugin
Unwar maven-assembly-plugin
Unzip maven-assembly-plugin
War maven-war-plugin
Zip maven-assembly-plugin
Optional Tasks  
Antlr maven-antlr-plugin
Depend maven-dependency-plugin
EJB Tasks maven-ejb-plugin
FTP maven-deploy-plugin
Note: maven-deploy-plugin can only deploy unto the FTP
JavaCC maven-compiler-plugin
JJDoc maven-compiler-plugin
JJTree maven-compiler-plugin
JUnit maven-surefire-plugin
JUnitReport maven-surefire-report-plugin
ServerDeploy maven-deploy-plugin
Setproxy maven-deploy-plugin
Translate maven-resources-plugin
Note: Translate can specify its own tokens and can have a different encoding scheme for reading and writing files. maven-resources-plugin however uses the \$... annotation only and has only one encoding scheme for reading and writing


나중에 도움이 될 것 같아 정리합니다.

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 자수씨
, |

글 보관함

최근에 받은 트랙백