maven 프로젝트의 java main 함수를 호출하고 싶다면 어찌해야 할까. 

junit을 이용해서 호출하는 방법이 제일 쉬우나 그렇지 않아야 하는 경우가 있음.

1. maven 프로젝트에  dependecy 된 jar를 가져옴.

2. java classpath 에 연결 하여 실행.


SHELL을 이용함. 

#/bin/sh

cd mvn-project;

(

mvn -pl mvn-sub-project dependency:copy-dependencies

)

cd mvn-sub-project/target/test-classes

java -cp .:../dependency/*com/hello/Hello


* 와일드 카드는 java 1.6 버전부터 되는걸로 알고 있음.

'MAVEN' 카테고리의 다른 글

[MAVEN] maven-surefire-plugin classpath  (0) 2014.04.17
maven-surefire-plugin 원격 디버깅.  (0) 2013.10.08
Posted by 마법수정화살
,