脚步不停,信念不息!

不积跬步无以至千里,不积小流无以成江海。

Ant报错Open quote is expected for attribute "*A" associated with an element type "*B"

解决路径:

依据报错信息提示:找到 元素"*B"查看该元素下的”*A“属性存在的异常,一般都是格式问题。因为是xml文件,可以考虑将文件用NotPad++、dreamweaver等工具打开,文件的格式信息会有所体现,仔细查看,就能发现问题。(会有一种感觉,没有什么大不了。。。。工具是神奇的!!!)

常见问题:

D:\>ant
Buildfile: build.xml

BUILD FAILED
D:\build.xml:4: Open quote is expected for attribute "file" associated with an  element type  "copy".

Total time: 2 seconds
D:\>ant
Buildfile: build.xml

BUILD FAILED
D:\build.xml:4: Open quote is expected for attribute "overwrite" associated with an  element type  "copy".

Total time: 0 seconds

build.xml内容:

// 【改前】简单示例
<?xml version="1.0" encoding="GBK"?>
<project name="测试脚本" default="copyfile" basedir=".">
	<target name="copyfile">
		<copy file="d:/BugReport.txt" todir="c:/temp" overwrite="true"/>
	</target>
</project>

解决方案:

将copy中的双引号(")换成单引号(')

修改后的build.xml内容:

// 【改后】简单示例
<?xml version="1.0" encoding="GBK"?>
<project name="测试脚本" default="copyfile" basedir=".">
	<target name="copyfile">
		<copy file='d:/BugReport.txt' todir='c:/temp' overwrite='true'/>
	</target>
</project>
执行结果(成功!):

D:\>ant
Buildfile: build.xml

copyfile:
     [copy] Copying 1 file to C:\temp

BUILD SUCCESSFUL
Total time: 1 second
D:\>ant
Buildfile: build.xml

copyfile:
     [copy] Copying 1 file to C:\temp

BUILD SUCCESSFUL
Total time: 0 seconds
D:\>

这都是我们喜欢看到的!!!
阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wangqingbo0829/article/details/51670681
文章标签: Ant
上一篇Server Tomcat v*.* Server at localhost failed to start.
下一篇mysql解压配置版安装
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭