首页 \ 问答 \ ANT - 如何使用排除,用javac排除文件?(ANT - how to use exclude, excludesfile with javac?)

ANT - 如何使用排除,用javac排除文件?(ANT - how to use exclude, excludesfile with javac?)

看了看stackoverflow以及其他来源(在线+ ANT定义指导手册)的几篇文章,但目前为止他们都没有帮助。 我无法从编译中排除该文件。

我只有一个文件希望从编译中排除,而ANT文档并没有真正说明细节。 我试图从编译中排除HTMLParser.java 。 还尝试使用excludesfile了。 但它仍然符合HTMLParser.java

我写了简单的ANT来检查下面尝试不同的变化。

谁能告诉我什么是错的?

<javac srcdir="${utilitiesSrc}" destdir="${dest}">
      <excludesfile name="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan\utilities\HTMLParser.java" />
</javac>

<project 
     name="CompileMasatosan"  
     default="main"
     basedir="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan">

     <property name="dest"
    location="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\WEB-INF\classes" />


     <property name="utilitiesSrc" 
        location="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan\utilities" />

    <javac srcdir="${utilitiesSrc}" destdir="${dest}">
         <exclude name="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan\utilities\HTMLParser.java" />
    </javac>
</project>

我相信HTMLParser.java没有依赖关系,因为除了类声明行外,我评论了所有行。

HTMLParser.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();
    }
    */
}//

UPDATE

正如评论中所建议的那样,我将excludesfile name属性更改为srcdir的相对路径,就是这样! 所以剪断看起来像:

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

Looked at several post on stackoverflow as well as other sources (online + ANT definition guide book) but none of them helped so far. I can't exclude the file from compiling.

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

I wrote simple ANT to examine trying different variation below.

Could anyone tell me what's wrong?

<javac srcdir="${utilitiesSrc}" destdir="${dest}">
      <excludesfile name="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan\utilities\HTMLParser.java" />
</javac>

<project 
     name="CompileMasatosan"  
     default="main"
     basedir="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan">

     <property name="dest"
    location="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\WEB-INF\classes" />


     <property name="utilitiesSrc" 
        location="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan\utilities" />

    <javac srcdir="${utilitiesSrc}" destdir="${dest}">
         <exclude name="C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\head_first\src\com\masatosan\utilities\HTMLParser.java" />
    </javac>
</project>

The HTMLParser.java I believe has no dependency since I commented all lines out except class declaration line.

HTMLParser.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();
    }
    */
}//

UPDATE

As suggested in the comment, I change the excludesfile name attribute to relative path of srcdir and that was it! So the snipped looks like:

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

原文:https://stackoverflow.com/questions/3808612
更新时间:2022-03-23 14:03

最满意答案

如果你正在谈论一个网站,那么“现场”,那么答案就是“不”。 在文件生效之前,您不要使用'git''提交'更改。

第二个你用filezilla,html或者js或你正在编辑的任何东西覆盖你的远程文件,你可以立即生效,而无需输入任何'git'命令

但是,如果你不这样做

git -A .
git commit
git push

那么你就不会拥有一个全面的“提交”你的网站,你可以用它作为备份来回滚,以防“发生不好的事情”

这是否回答你的问题?


insofar as 'being live' if you are talking about a website, then the answer is 'no'. You do not to 'commit' changes with 'git' before the files are live.

the second you overwrite your remote file with your local copy from filezilla, the html, or js or whatever you're editing will be live immediately without typing any 'git' commands

However, if you do not do

git -A .
git commit
git push

then you will not have an all encompassing 'commit' of your website that you can use as a backup to rollback to in case 'something bad happens'

does that answer your question?

相关问答

更多
  • FileZilla Server windows2003\window2008\windows2012服务器 首先下载filezilla server软件,如下图所示: 将下载好的FileZilla_Server-0_9_41.exe软件拷贝到服务器上双击安装 默认点击下一步即可直至安装成功 安装完成显示如下窗口,点击ok就可以了。 Logged on代表登录成功,也代表你filezilla server软件安装成功。 点击导航栏上在一个小人的按钮。代表的是添加用户。 点击右下角Add,代表添加新用户,输入 ...
  • 在FileZilla 2.2.32中,转到编辑>设置>文件传输设置> ASCII /二进制。 将其设置为始终为二进制:这应该是诀窍。 在FileZilla 3.5.0中,设置在编辑>设置>传输>文件类型>默认传输类型>二进制。 In FileZilla 2.2.32, go Edit > Settings > File transfer settings > ASCII/Binary. Set it to always binary: that should do the trick. In FileZil ...
  • FileZilla不支持从其他应用程序进行任何类型的导入。 编写脚本将WinSCP INI配置文件转换为FileZilla XML配置文件应该不那么困难。 如果值得努力,取决于你有多少次会话。 将通过WinSCP加密的密码转换为FileZilla使用的未加密(或base64编码)形式将是最具挑战性的(如果您保存密码)。 请注意,一旦您意识到WinSCP更好,并且您决定切换回来,您可以轻松地将新的FileZilla会话导入到WinSCP中: https://winscp.net/eng/docs/ui_imp ...
  • 如果你正在谈论一个网站,那么“现场”,那么答案就是“不”。 在文件生效之前,您不要使用'git''提交'更改。 第二个你用filezilla,html或者js或你正在编辑的任何东西覆盖你的远程文件,你可以立即生效,而无需输入任何'git'命令 但是,如果你不这样做 git -A . git commit git push 那么你就不会拥有一个全面的“提交”你的网站,你可以用它作为备份来回滚,以防“发生不好的事情” 这是否回答你的问题? insofar as 'being live' if you are ...
  • 你不需要FileZilla就可以了。 您只需将文件从“ My Documents移动到Wamp安装的www目录即可。 然后,您可以将URL指向该文件。 因此,如果您有一个文件foobar.php并将其拖动到www那么您可以访问http://localhost/foobar.php 。 You don't need FileZilla for what you are after. You simply need to move your files from My Documents to the www ...
  • 请转到filezilla中的设置。 在传输 - >文件类型下将默认传输类型设置为二进制。 我认为这将解决问题。 Please go to the settings in filezilla. There under transfers --> file type set the default transfer type to Binary. I think this will fix the problem.
  • 好吧,所以我开始下载FileZilla版本回到3.14.0并注意到所有主题与当前版本完全相同,所以我下载了与我创建此问题时匹配的版本,即3.23。 0.2。 那个版本违背了新主题的主题。 我下载了3.22.2.2,主题默认为OpenCrystal。 事实证明,他们从未创建过新的默认主题,只是更改了默认主题! 抱歉浪费了一个问题。 Alright, so I started downloading FileZilla versions going back to 3.14.0 and noticed that ...
  • 我相信你的主要问题是你在ZIP仍然被转移时尝试处理它。 可能会发生的是,一旦启动传输,WinSCP就会创建一个临时文件来存储传输的数据。 在zip文件被完全转移之前,该事件将触发您的脚本。 这可以解释为什么你会收到这个错误: 找不到中心目录签名。 这个文件不是zipfile, 所以解决方案是将两个文件夹用于传输,一个用于compelete。 它们应该在同一个文件系统中。 转移完成后,只需从一个文件夹移动到另一个文件 I believe your main issue is you try to proces ...
  • 更新的答案 似乎GNUtls ,由homebrew安装,带有pkgconfig文件。 因此,如果您还没有使用pkgconfig,则需要安装pkgconfig : brew install pkgconfig 然后,一旦你有了,你可以找到编译器包含文件设置: pkg-config --cflags gnutls 样本输出 -I/usr/local/Cellar/gnutls/3.5.8/include -I/usr/local/Cellar/nettle/3.3/include -I/usr/local/ ...
  • 为了按名称执行可执行文件,需要在path包含filezilla.exe文件。 这可以通过以下方式实现 set path=%path%;the\directory\where\filezilla\resides 或者,你可以使用 the\directory\where\filezilla\resides\filezilla.exe -c "0/mysitename" In order for an executable to be executed by name, the filezilla.exe f ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。