2010-03-09 4 views
3

는 build.xml 파일의 코드로이 상상 :개미 작업을 두 번 이상 수행하려면 어떻게해야합니까?

first,first,second,third 
:

ant third 

나는 다음과 같은 출력을받을 것이다 : 나는 실행할 때 나는 그래서 어떻게해야합니까 무엇

<project name="test project"> 
    <target name="first"> 
     <echo>first</echo> 
    </target> 
    <target name="second" depends="first"> 
     <echo>second</echo> 
    </target> 
    <target name="third" depends="first,second"> 
     <echo>third</echo> 
    </target> 
</project> 

즉, 이전에 실행되었는지 여부에 관계없이 각 종속성을 실행하고 싶습니다.

답변

4

그게 무슨 종속이 아니에요.

동작이 필요한 경우 대신 antcall 또는 MacroDef을 사용하십시오.

<project name="test project"> 
    <target name="first"> 
     <echo>first</echo> 
    </target> 
    <target name="second"> 
     <antcall target="first" /> 
     <echo>second</echo> 
    </target> 
    <target name="third"> 
     <antcall target="first" /> 
     <antcall target="second" /> 
     <echo>third</echo> 
    </target> 
</project> 

> ant third 
Buildfile: build.xml 

third: 

first: 
    [echo] first 

second: 

first: 
    [echo] first 
    [echo] second 
    [echo] third 

BUILD SUCCESSFUL 
Total time: 0 seconds 
관련 문제