English 中文(简体)
ANT - 如何使用排他性,将file子排除在外?
原标题:ANT - how to use exclude, excludesfile with javac?

审视了几个关于中继流动和其他来源的员额(在线+ ANT定义指南书),但迄今没有任何一个帮助。 我不能将档案排除在汇编之外。

I have just one file that wants to exclude from compiling and ANT documentation is not really telling the detail. I m trying to exclude HTMLParser.java from compiling. Also tried using excludesfile too. But it still complies HTMLParser.java

我写了简便的国别评估,以审查试图在下文中作出不同改动的情况。

谁能告诉我什么错误?

<javac srcdir="${utilitiesSrc}" destdir="${dest}">
      <excludesfile name="C:Program FilesApache Software FoundationTomcat 6.0webappshead_firstsrccommasatosanutilitiesHTMLParser.java" />
</javac>

<project 
     name="CompileMasatosan"  
     default="main"
     basedir="C:Program FilesApache Software FoundationTomcat 6.0webappshead_firstsrccommasatosan">

     <property name="dest"
    location="C:Program FilesApache Software FoundationTomcat 6.0webappshead_firstWEB-INFclasses" />


     <property name="utilitiesSrc" 
        location="C:Program FilesApache Software FoundationTomcat 6.0webappshead_firstsrccommasatosanutilities" />

    <javac srcdir="${utilitiesSrc}" destdir="${dest}">
         <exclude name="C:Program FilesApache Software FoundationTomcat 6.0webappshead_firstsrccommasatosanutilitiesHTMLParser.java" />
    </javac>
</project>

The RUSParser.java 我认为没有任何依赖性,因为我评论了除阶级声明线以外的所有线。

<>斯特罗敦>

package com.masatosan.utilities;

public class HTMLParser {
/*  commenting out since Eclipse doesn t like some characters :(

    public static final String escapeHTML(String s){
           StringBuffer sb = new StringBuffer();
           int n = s.length();
           for (int i = 0; i < n; i++) {
              char c = s.charAt(i);
              switch (c) {
                 case  < : sb.append("&lt;"); break;
                 case  > : sb.append("&gt;"); break;
                 case  & : sb.append("&amp;"); break;
                 case  " : sb.append("&quot;"); break;
                 case  à : sb.append("&agrave;");break;
                 case  À : sb.append("&Agrave;");break;
                 case  â : sb.append("&acirc;");break;
                 case  Â : sb.append("&Acirc;");break;
                 case  ä : sb.append("&auml;");break;
                 case  Ä : sb.append("&Auml;");break;
                 case  å : sb.append("&aring;");break;
                 case  Ã… : sb.append("&Aring;");break;
                 case  æ : sb.append("&aelig;");break;
                 case  Æ : sb.append("&AElig;");break;
                 case  ç : sb.append("&ccedil;");break;
                 case  Ç : sb.append("&Ccedil;");break;
                 case  é : sb.append("&eacute;");break;
                 case  É : sb.append("&Eacute;");break;
                 case  è : sb.append("&egrave;");break;
                 case  È : sb.append("&Egrave;");break;
                 case  ê : sb.append("&ecirc;");break;
                 case  Ê : sb.append("&Ecirc;");break;
                 case  ë : sb.append("&euml;");break;
                 case  Ë : sb.append("&Euml;");break;
                 case  ï : sb.append("&iuml;");break;
                 case  � : sb.append("&Iuml;");break;
                 case  ô : sb.append("&ocirc;");break;
                 case  Ô : sb.append("&Ocirc;");break;
                 case  ö : sb.append("&ouml;");break;
                 case  Ö : sb.append("&Ouml;");break;
                 case  ø : sb.append("&oslash;");break;
                 case  Ø : sb.append("&Oslash;");break;
                 case  ß : sb.append("&szlig;");break;
                 case  ù : sb.append("&ugrave;");break;
                 case  Ù : sb.append("&Ugrave;");break;         
                 case  û : sb.append("&ucirc;");break;         
                 case  Û : sb.append("&Ucirc;");break;
                 case  ü : sb.append("&uuml;");break;
                 case  Ü : sb.append("&Uuml;");break;
                 case  ® : sb.append("&reg;");break;         
                 case  © : sb.append("&copy;");break;   
                 case  € : sb.append("&euro;"); break;
                 // be carefull with this one (non-breaking whitee space)
                 case    : sb.append("&nbsp;");break;         

                 default:  sb.append(c); break;
              }
           }
           return sb.toString();
    }
    */
}//

<>>>>>

正如评论中所建议的那样,我改变了排除文件名称的属性,即是 s的相对途径,而是! 因此, s看起来:

<javac srcdir="${utilitiesSrc}" destdir="${dest}">
      <excludesfile name="HTMLParser.java" />
</javac>
最佳回答

我认为,你已经核实的明显事实是,你正在编纂的任何东西都不依赖超文本字节。 如果情况如此,支尔瓦茨指挥部将汇编档案。

为了澄清,上述问题正在使用排除财产的绝对道路。 如果有ir子,ant子就会形成一条暗中的道路,排除档案名称。

问题回答

具体注明<代码>,不适用,作为与<代码>javac srcdir(=$-utilitiesSrc}的指南。

例如,你的最后一项任务是:

<javac srcdir="${utilitiesSrc}" destdir="${dest}">
    <exclude name="HTMLParser.java" />
</javac>

如果档案存放在一份子名录中,${utilitiesSrc}的目录中,你可将其与rel=“noreferer”>wildcard :

<javac srcdir="${utilitiesSrc}" destdir="${dest}">
    <exclude name="**/HTMLParser.java" />
</javac>




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签