2016-09-16 3 views
0

다양한 -D 속성이 전달되는 여러 작업을 실행하는 프로세스가 있습니다. ant 명령 줄에 전달 된 -D 속성 목록을 가져 오는 방법이 있습니까?ant 명령 줄의 -D 속성 목록

답변

0

당신은

<propertyset id="commandline-properties"> 
    <propertyref builtin="commandline"/> 
</propertyset> 

으로 명령 줄에 지정된 모든 속성을 얻고을 보여 <echoproperties>를 사용할 수 있습니다. propertyset에는 빌드 파일이 ant.file이고 빌드 파일의 유형이 ant.file.type이고 명령 행에서 호출 된 대상이 ant.project.invoked-targets 인 명령 행과 관련된 몇 가지 특수 Ant 특성이 포함됩니다. 예 :

$ cat < props.xml 
<project> 
    <echoproperties> 
    <propertyset> 
     <propertyref builtin="commandline"/> 
    </propertyset> 
    </echoproperties> 
</project> 
$ ant -f props.xml -Dfoo=bar -Dxyzzy=quoox 
Buildfile: /tmp/props.xml 
[echoproperties] #Ant properties 
[echoproperties] #Fri Sep 16 22:21:51 CEST 2016 
[echoproperties] ant.file=/tmp/props.xml 
[echoproperties] ant.file.type=file 
[echoproperties] ant.project.invoked-targets= 
[echoproperties] foo=bar 
[echoproperties] xyzzy=quoox 

BUILD SUCCESSFUL 
Total time: 0 seconds