2013-02-07 2 views
2

summary="true" 해당 개미가 replaceregexp 개임과 비슷한 개미가 있습니까? replace 개 작업이 있습니까?개미 대체 replaceregexp 작업에서 출력 대체 요약

내 사용 사례입니다.

<replace dir="${dir}" summary="true" value="" token="Some Text"> 
    <include name="**/*.jsp" /> 
</replace> 

이되다 : 그래서처럼 replaceregexp 작업과 작업을 대신 개미를 교체하고 내가 교체의 수를 내 개미 빌드 출력을 할 수있는 방법을 찾을 수없는, 그러나

<replaceregexp byline="true"> 
    <regexp pattern="Some\s*Text"/> 
    <substitution expression=""/> 
<fileset dir="${dir}" includes="**/*.jsp"/> 
</replaceregexp> 

을하는 만들어졌다. replaceregexp에 대한 summary 특성이 없으며 문서에 준비 제안이 없습니다. 이것이 가능한가?

답변

2

ReplaceRegexp 작업의 소스를 읽는 데 이러한 기능이 없습니다.
ant184 => SRC/메인/조직/아파치/도구/개미/taskdefs/옵션/ReplaceRegExp.java, 라인 351 :
ant -verbose -f yourfile.xml
나 :

protected void doReplace(File f, int options) throws IOException { 
     File temp = FILE_UTILS.createTempFile("replace", ".txt", null, true, true); 

     Reader r = null; 
     Writer w = null; 
     BufferedWriter bw = null; 

     try { 
      if (encoding == null) { 
       r = new FileReader(f); 
       w = new FileWriter(temp); 
      } else { 
       r = new InputStreamReader(new FileInputStream(f), encoding); 
       w = new OutputStreamWriter(new FileOutputStream(temp), 
              encoding); 
      } 

      BufferedReader br = new BufferedReader(r); 
      bw = new BufferedWriter(w); 

      boolean changes = false; 

      log("Replacing pattern '" + regex.getPattern(getProject()) 
       + "' with '" + subs.getExpression(getProject()) 
       + "' in '" + f.getPath() + "'" + (byline ? " by line" : "") 
       + (flags.length() > 0 ? " with flags: '" + flags + "'" : "") 
       + ".", Project.MSG_VERBOSE); 

수단은 대체를 기록하는 로그 레벨 자세한 사용
ant -v -f yourfile.xml

ant source distribution file를 확인하고 간단하게 예를 들어, 작업을 원하는 출력을 얻을 수 doReplace() 메소드를 확장에서 새 작업에 의해 제어되는 교체에 대한 카운터, tribute 'summary'false | true
enhancement report을 채우고 다음 개미판에 다른 사용자가 사용할 수 있도록 패치를 제출하십시오 (자세한 내용은 here).