- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我最初有这个:
<echo file="${my.file}"
message="This is line #1"/>
<echo file="${my.file}"
append="true"
message="This is line #2"/>
<echo file="${my.file}"
append="true"
message="This is line #3"/>
在我的文件中得到这个:
This is line#1This is line #2This is line#3
所以,我试过:
<echo file="${my.file}">
This is line #1
This is line #2
This is line #3
</echo>
得到:
This is line#1This is line #2This is line#3
我这样做了:
<echo file="${my.file}">
This is line #1${line.separator}
This is line #2${line.separator}
This is line #3${line.separator}
</echo>
得到:
This is line#1This is line #2This is line#3
我这样做了:
<echo file="${my.file}">
This is line #1
This is line #2
This is line #3
</echo>
得到:
This is line#1This is line #2This is line#3
我什至试过这个:
<concat destfile="${my.file}">
This is line #1
This is line #2
This is line #3
</concat>
还有:
This is line#1This is line #2This is line#3
如果我对控制台执行任何这些操作,它会打印在不同的行上。将它们保存到一个文件中,这些行不会显示。
我在 Win7,Ant 1.8 什么的。
有什么想法吗?
我已经在我的 Mac 上尝试了其中的每一个。第一个给了我相同的结果。但是,第二种方式在文件中给了我三行。第三种方式与${line.separator}
添加跳过每隔一行。第四种方式使用 &10;
给了我所有其他行 ^M
最后(毕竟 Mac 是 Unix 并且不使用 CRLF 结尾,而只是 LF)。
并且,使用 <concat>
还创建了单独的行。
我已将问题追溯到我的 build.xml
中的以下片段文件:
这与宣传的一样有效。即,空白和 NL
显示在结果文件中:
<target name="package"
depends="-resolve,compile"
description="Packaging of the artifact">
<!-- Build version.txt and let the user figure out how to use it -->
<mkdir dir="${target.dir}"/>
<echo file="${version.file}">
Jenkins Project: ${env.JOB_NAME}
Jenkins Build Number: ${env.BUILD_NUMBER}
Build Date: ${build.date}
</echo>
<!--
<antcall target="jar"/>
<antcall target="war"/>
<antcall target="ear"/>
-->
</target>
这不是:
<target name="package"
depends="-resolve,compile"
description="Packaging of the artifact">
<!-- Build version.txt and let the user figure out how to use it -->
<mkdir dir="${target.dir}"/>
<echo file="${version.file}">
Jenkins Project: ${env.JOB_NAME}
Jenkins Build Number: ${env.BUILD_NUMBER}
Build Date: ${build.date}
</echo>
<antcall target="jar"/>
<antcall target="war"/>
<antcall target="ear"/>
</target>
这些片段之间的唯一区别在于我做了三个 <antcall>
写入文件后的任务。三个 antcall 任务都有一个 if
子句,因此它们可能会或可能不会根据设置的属性运行。这是我们开发团队的构建模板,所以我真的很想让它发挥作用。
为什么 <antcall>
会引起问题。顺便说一句,有时它太坏了,我需要重新打开一个新的控制台窗 Eloquent 能获得 NL
工作的东西。
我以前遇到过类似的问题,这是 Windows 代码页问题。
最佳答案
下面的 Ant 项目使用 echo
任务创建了四个文件:
项目在Windows 7上使用Ant 1.8.x运行时,各个文件的十六进制 View 如下:
// echo1.txt
// HEX // TEXT
6c 69 6e 65 20 23 31 line #1
6c 69 6e 65 20 23 32 line #2
6c 69 6e 65 20 23 33 line #3
// echo2.txt
// HEX // TEXT
6c 69 6e 65 20 23 31 0a line #1 (0a => line feed)
6c 69 6e 65 20 23 32 0a line #2
6c 69 6e 65 20 23 33 0a line #3
// echo3.txt
// HEX // TEXT
6c 69 6e 65 20 23 31 0d 0a 0a line #1 (0d => carriage return)
6c 69 6e 65 20 23 32 0d 0a 0a line #2
6c 69 6e 65 20 23 33 0d 0a 0a line #3
// echo4.txt
// HEX // TEXT
6c 69 6e 65 20 23 31 0d 0a line #1
6c 69 6e 65 20 23 32 0d 0a line #2
6c 69 6e 65 20 23 33 0d 0a line #3
只有 echo4.txt [它将所有三行放在 message
属性中,由 ${line.separator}
分隔] 产生正确的行结束在 Windows 上(回车+ 换行)。在记事本(使用回车 + 换行)以及保留 Unix 行结尾的编辑器(单换行)中编辑项目文件时,输出是相同的。看起来,当 Ant 解析 XML 文件时,行结尾被规范化为单个换行符。
<?xml version="1.0" encoding="UTF-8"?>
<project name="echo-project" basedir="." default="echo-all">
<target name="echo-test1">
<property name="echo1.file" location="${basedir}/echo1.txt" />
<echo file="${echo1.file}" message="line #1" />
<echo file="${echo1.file}" message="line #2" append="true" />
<echo file="${echo1.file}" message="line #3" append="true" />
</target>
<target name="echo-test2">
<property name="echo2.file" location="${basedir}/echo2.txt" />
<echo file="${echo2.file}">line #1
line #2
line #3
</echo>
</target>
<target name="echo-test3">
<property name="echo3.file" location="${basedir}/echo3.txt" />
<echo file="${echo3.file}">line #1${line.separator}
line #2${line.separator}
line #3${line.separator}
</echo>
</target>
<target name="echo-test4">
<property name="echo4.file" location="${basedir}/echo4.txt" />
<echo file="${echo4.file}" message=
"line #1${line.separator}line #2${line.separator}line #3${line.separator}" />
</target>
<target name="echo-all"
depends="echo-test1, echo-test2, echo-test3, echo-test4" />
</project>
关于windows - 回显到文件时 Ant 不会创建 NL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11836703/
前言: 有时候,一个数据库有多个帐号,包括数据库管理员,开发人员,运维支撑人员等,可能有很多帐号都有比较大的权限,例如DDL操作权限(创建,修改,删除存储过程,创建,修改,删除表等),账户多了,管理
所以我用 Create React App 创建并设置了一个大型 React 应用程序。最近我们开始使用 Storybook 来处理和创建组件。它很棒。但是,当我们尝试运行或构建应用程序时,我们不断遇
遵循我正在创建的控件的代码片段。这个控件用在不同的地方,变量也不同。 我正在尝试编写指令来清理代码,但在 {{}} 附近插入值时出现解析错误。 刚接触 Angular ,无法确定我错过了什么。请帮忙。
我正在尝试创建一个 image/jpeg jax-rs 提供程序类,它为我的基于 post rest 的 Web 服务创建一个图像。我无法制定请求来测试以下内容,最简单的测试方法是什么? @POST
我一直在 Windows 10 的模拟器中练习 c。后来我改用dev C++ IDE。当我在 C 中使用 FILE 时。创建的文件的名称为 test.txt ,而我给出了其他名称。请帮助解决它。 下面
当我们创建自定义 View 时,我们将 View 文件的所有者设置为自定义类,并使用 initWithFrame 或 initWithCode 对其进行实例化。 当我们创建 customUITable
我正在尝试为函数 * Producer 创建一个线程,但用于创建线程的行显示错误。我为这句话加了星标,但我无法弄清楚它出了什么问题...... #include #include #include
今天在做项目时,遇到了需要创建JavaScript对象的情况。所以Bing了一篇老外写的关于3种创建JavaScript对象的文章,看后跟着打了一遍代码。感觉方法挺好的,在这里与大家分享一下。 &
我正在阅读将查询字符串传递给 Amazon 的 S3 以进行身份验证的文档,但似乎无法理解 StringToSign 的创建和使用方式。我正在寻找一个具体示例来说明 (1) 如何构造 String
前言:我对 C# 中任务的底层实现不太了解,只了解它们的用法。为我在下面屠宰的任何东西道歉: 对于“我怎样才能开始一项任务但不等待它?”这个问题,我找不到一个好的答案。在 C# 中。更具体地说,即使任
我有一个由一些复杂的表达式生成的 ILookup。假设这是按姓氏查找人。 (在我们简单的世界模型中,姓氏在家庭中是唯一的) ILookup families; 现在我有两个对如何构建感兴趣的查询。 首
我试图创建一个 MSI,其中包含 和 exe。在 WIX 中使用了捆绑选项。这样做时出错。有人可以帮我解决这个问题。下面是代码: 错误 error LGH
在 Yii 中,Create 和 Update 通常使用相同的形式。因此,如果我在创建期间有电子邮件、密码、...other_fields...等字段,但我不想在更新期间专门显示电子邮件和密码字段,但
上周我一直在努力创建一个给定一行和一列的 QModelIndex。 或者,我会满足于在已经存在的 QModelIndex 中更改 row() 的值。 任何帮助,将不胜感激。 编辑: QModelInd
出于某种原因,这不起作用: const char * str_reset_command = "\r\nReset"; const char * str_config_command = "\r\nC
现在,我有以下由 original.df %.% group_by(Category) %.% tally() %.% arrange(desc(n)) 创建的 data.frame。 DF 5),
在今天之前,我使用/etc/vim/vimrc来配置我的vim设置。今天,我想到了创建.vimrc文件。所以,我用 touch .vimrc cat /etc/vim/vimrc > .vimrc 所
我可以创建一个 MKAnnotation,还是只读的?我有坐标,但我发现使用 setCooperative 手动创建 MKAnnotation 并不容易。 想法? 最佳答案 MKAnnotation
在以下代码中,第一个日志语句按预期显示小数,但第二个日志语句记录 NULL。我做错了什么? NSDictionary *entry = [[NSDictionary alloc] initWithOb
我正在使用与此类似的代码动态添加到数组; $arrayF[$f+1][$y][$x+1] = $value+1; 但是我在错误报告中收到了这个: undefined offset :1 问题:尝试创
我是一名优秀的程序员,十分优秀!