ant를 이용해서, lib 폴더의 denendency jar file을 manifest의 class-path에 손쉽게 추가하기...
from Tools 2010/11/09 17:17
자바로 프로젝트를 하다보면, 몇개의 라이브러리는 기본적으로 사용을 합니다.
좀 큰 프로젝트를 하다보면, 적게는 10개이상의 라이브러리를 사용할 텐데요.. 빌드를 하면서 의존 라이브러리를 일일히 manifest 파일에 기입을 해 주기는 매우 불편한 일이 되겠죠..
하지만, lib 폴더의 jar파일을 동적으로 로딩해서 jar로 배포할 때 넣어주면, 위 불편함이 순식간에 가시겠죵??ㅋㅋ
사용방법은 아래처럼 사용하면 됩니다.
아래 코드를 build.xml에 넣으시면 됩니다.
위 코드는 아래 링크에서 가져왔습니다. 너무 감사드립니다.. ^^
좀 큰 프로젝트를 하다보면, 적게는 10개이상의 라이브러리를 사용할 텐데요.. 빌드를 하면서 의존 라이브러리를 일일히 manifest 파일에 기입을 해 주기는 매우 불편한 일이 되겠죠..
하지만, lib 폴더의 jar파일을 동적으로 로딩해서 jar로 배포할 때 넣어주면, 위 불편함이 순식간에 가시겠죵??ㅋㅋ
사용방법은 아래처럼 사용하면 됩니다.
<attribute name="Class-Path" value="lib/ conf/ ${lib-manifest-path}" />
아래 코드를 build.xml에 넣으시면 됩니다.
<target name="gen-manifest" description="Generate CLASSPATH to use in manifest">
<pathconvert dirsep='${file.separator}' property="full-lib-dir">
<path>
<pathelement path="lib"/>
</path>
</pathconvert>
<echo>full-lib-dir: ${full-lib-dir}</echo>
<pathconvert pathsep=" " dirsep="/" property="manifest-path">
<path>
<fileset dir="lib" includes="*"/>
</path>
<map from="${full-lib-dir}${file.separator}" to=""/>
</pathconvert>
<echo>manifest-path: ${manifest-path}</echo>
<pathconvert pathsep=" " dirsep="/" property="lib-manifest-path">
<path>
<fileset dir="lib" includes="*"/>
</path>
<map from="${full-lib-dir}${file.separator}" to="lib/"/>
</pathconvert>
<echo>lib-manifest-path: ${lib-manifest-path}</echo>
</target>
<pathconvert dirsep='${file.separator}' property="full-lib-dir">
<path>
<pathelement path="lib"/>
</path>
</pathconvert>
<echo>full-lib-dir: ${full-lib-dir}</echo>
<pathconvert pathsep=" " dirsep="/" property="manifest-path">
<path>
<fileset dir="lib" includes="*"/>
</path>
<map from="${full-lib-dir}${file.separator}" to=""/>
</pathconvert>
<echo>manifest-path: ${manifest-path}</echo>
<pathconvert pathsep=" " dirsep="/" property="lib-manifest-path">
<path>
<fileset dir="lib" includes="*"/>
</path>
<map from="${full-lib-dir}${file.separator}" to="lib/"/>
</pathconvert>
<echo>lib-manifest-path: ${lib-manifest-path}</echo>
</target>
위 코드는 아래 링크에서 가져왔습니다. 너무 감사드립니다.. ^^
Ant: construct manifest classpath
'Tools' 카테고리의 다른 글
| restfb 로그 console에 찍히는거 제거.. (0) | 2011/03/08 |
|---|---|
| eclipse의 xml editor plug-in rinzo xml editor (0) | 2010/12/27 |
| ant를 이용해서, lib 폴더의 denendency jar file을 manifest의 class-path에 손쉽게 추가하기... (0) | 2010/11/09 |
| json java 라이브러리 google-gson의 기본 캐릭터셋은 utf-8 이군요.. (1) | 2010/11/04 |
| ROME Library를 이용한 Atom/RSS 읽어오기.. (0) | 2010/10/26 |