Ant 构建复制文件时出错,“访问被拒绝" [英] Error with Ant build copying files, "Access is denied"

查看:38
本文介绍了Ant 构建复制文件时出错,“访问被拒绝"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 Ant 版本中出现了一个奇怪的错误.构建是这样工作的:build.xml 调用一个新的 buildTargets.xml 文件,大部分工作都在该文件中完成.buildTargets.xml 在 gwt-out/htdocs/** 和另一个目录 staging/htdocs/** 中创建了一堆新文件.基本上,文件是在 gwt-out/htdocs 中创建的,然后复制到 staging/htdocs 中.错误是只有一个文件没有被复制,我收到了 java.IO.FileNotFoundException (Access is denied) 错误.奇怪的部分是文件从构建到构建都发生了变化.

I have a weird bug that is popping up in my Ant build. The build works as such: build.xml calls a new buildTargets.xml file, and in that file most of the work is being done. buildTargets.xml creates a bunch of new files in gwt-out/htdocs/** and another directory staging/htdocs/**. Basically, files are being created in gwt-out/htdocs and then copied into staging/htdocs. The error is that only one file is not being copied, and I am getting a java.IO.FileNotFoundException (Access is denied) error. The weird part is that the file changes from build to build.

起初我认为这是一个 Eclipse 问题,所以我通过命令行构建,并且一个新的(与 eclipse 不同的文件)没有被放入 staging/htdocs,这产生了同样的错误.我已经附上了 Ant 所说的带有 -debug 标志的内容.当文件在 buildTargets.xml 中被标记时,错误似乎会弹出.在四处搜索之后,似乎最常见的响应是修复我的权限——但是该文件是动态创建的,当我去检查该文件时,所有权限都已启用(特殊"除外),所以我不认为这是问题.

At first I thought it was an Eclipse problem so I built through the command line, and a new (a different file than eclipse) was not being put into staging/htdocs, which was yielded the same error. I've attached what Ant has said with the -debug flag. The error seems to pop up when the files are being tokenized in buildTargets.xml. After searching around it seems that the most common response was to fix my permissions-- however the file is being dynamically created, and when I go to check on that file all permissions are enabled (except "Special"), so I don't think that's the issue.

与我类似的其他 SO 问题都涉及在远程服务器上构建并修复我对该服务器的权限——但是这都是我的计算机本地的,所以我也不确定这是否是问题.会不会是 Ant 构建中的复制任务出错?

Other SO questions similar to mine all deal with building on a remote server and fixing my permissions to that server-- however this is all local to my computer, so I'm not sure that is the issue either. Could it be an error with the copying task in the Ant build?

错误如下:

BUILD FAILED
C:\CSDK\build\buildTargets.xml:253: Failed to copy C:\Users\admin\worksp
ace\BuildPortal\out\gwt-out\htdocs\war\BuildPortalTest.iOS_Bu
ild_Portal\sc\modules\ISC_DataBinding.js to C:\Users\admin\workspace\BuildPortal
\out\staging\htdocs\war\BuildPortalTest.iOS_Build_Portal\sc\m
odules\ISC_DataBinding.js due to java.io.FileNotFoundException C:\Users\admin\wo
rkspace\BuildPortal\out\staging\htdocs\war\BuildPortalTest.iO
S_Build_Portal\sc\modules\ISC_DataBinding.js (Access is denied)
        at org.apache.tools.ant.taskdefs.Copy.doFileOperations(Copy.java:907)
        at org.apache.tools.ant.taskdefs.Copy.execute(Copy.java:563)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
        at org.apache.tools.ant.Main.runBuild(Main.java:851)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.FileNotFoundException: C:\Users\admin\workspace\BuildPortal\o
ut\staging\htdocs\war\BuildPortalTest.iOS_Build_Portal\sc\mod
ules\ISC_DataBinding.js (Access is denied)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(Unknown Source)
        at java.io.FileOutputStream.<init>(Unknown Source)

谢谢.

推荐答案

我最终使用了 重试任务,这似乎是基于艾萨克对可能出错的地方的描述.

I ended up using the retry task, and that seemed to work based off of Isaac's description of what was possibly going wrong.

这篇关于Ant 构建复制文件时出错,“访问被拒绝"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆