98.6.3. Ant 스크립트 실행

다음 예제에서는 ant.bat 가 시스템 경로에 있고 CamelExecBuildFile.xml 이 현재 디렉터리에 있는 경우 빌드 파일 CamelExecBuildFile.xml 을 사용하여 Apache Ant (Windows만)를 실행합니다.

from("direct:exec")
.to("exec:ant.bat?args=-f CamelExecBuildFile.xml")

다음 예제에서 ant.bat 명령은 -l 를 사용하여 출력을 CamelExecOutFile.txt 로 리디렉션합니다. CamelExecOutFile.txt 파일은 outFile =CamelExecOutFile.txt의 외부 파일로 사용됩니다. 이 예제에서는 ant.bat 이 시스템 경로에 있고 CamelExecBuildFile.xml 이 현재 디렉터리에 있다고 가정합니다.

from("direct:exec")
.to("exec:ant.bat?args=-f CamelExecBuildFile.xml -l CamelExecOutFile.txt&outFile=CamelExecOutFile.txt")
.process(new Processor() {
     public void process(Exchange exchange) throws Exception {
        InputStream outFile = exchange.getIn().getBody(InputStream.class);
        assertIsInstanceOf(InputStream.class, outFile);
        // do something with the out file here
     }
  });