2013-08-12 4 views
0

개미 스크립트에서 이어 파일을 작성하려고합니다. 다른 프로젝트를 사용하는 .jar 파일과 .war 파일 (귀에 포함될 파일)을 생성하는 여러 대상이 있으며이 파일은 문제없이 구축되므로 포함하지 않을 것입니다. 귀 파일을 만들기 전에 전체 디렉토리 복사

이 디렉토리 구조를 상상 : - 개미 스크립트를 삭제하고 다시 만들어되고 빌드 디렉토리라고 그래서
Project1/ 
    build/ 
    lib/ 
    META-INF/ 
    build.xml 

, 모든 매우 표준 재료. 그런 다음 외부 프로젝트에서 jar와 war를 만들고 빌드에 저장합니다. - 모든 것이 정상입니다.

그러나 ear 파일에 lib/및 META-INF/디렉토리를 포함시키고 싶습니다. 그래서이 대상을 사용하여 빌드 디렉토리에 복사하려고합니다.

<target name="file_cleanup"> 
    <copy todir="${build}"> 
     <fileset dir="lib/"/> 
     <fileset dir="META-INF/"/> 
    </copy> 
</target> 

이 file_cleanup 목표는 귀를 생성하는 기본 빌드 타겟의 의존 - 아래 :

target1.jar 
target2.war 
lib/ 
META-INF/ 
: 나는 귀는 추출 할 때보고 싶은

<target name="ear" depends="initialise, file_cleanup, other targets..."> 
     <ear destfile="My.ear" appxml="META-INF/application.xml"> 
      <fileset dir="${build}" includes="*.jar,*.war"/> 
     </ear> 
    </target> 

하지만 실제로 얻을 수있는 것은 :

target1.jar 
target2.war 
and all of the contents of both the lib and META-INF directories... 

답변

2

추가 속성 및 디렉터리를 만들고 디렉터리 구조를 새 디렉터리에 복사하여이 문제를 해결할 수있었습니다.

<target name="initialise"> 
    <delete dir="${build}"/> 
    <mkdir dir="${build}"/> 
    <mkdir dir="${build}/${lib}"/> 
    <mkdir dir="${build}/${meta-inf}"/> 
</target> 


    <target name="file_cleanup"> 
     <copy todir="${build}/${lib}"> 
      <fileset dir="lib"/> 
     </copy> 
     <copy todir="${build}/${meta-inf}"> 
      <fileset dir="META-INF"/> 
     </copy> 
    </target> 
관련 문제