当我尝试运行JUnit测试时,所有文件都出现以下错误:
Error:Resource Compiler: Error: C:\Workspaces\Web\Application\main\tomcat\out\test\Test\log4j.xml (Access is denied)
java.io.FileNotFoundException: C:\Workspaces\Web\Application\main\tomcat\out\test\Test\log4j.xml (Access is denied)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:298)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:237)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:187)
at com.intellij.openapi.util.io.FileUtil.openOutputStream(FileUtil.java:492)
at com.intellij.openapi.util.io.FileUtil.performCopy(FileUtil.java:452)
at com.intellij.openapi.util.io.FileUtil.copyContent(FileUtil.java:447)
at org.jetbrains.jps.incremental.FSOperations.copy(FSOperations.java:371)
at org.jetbrains.jps.incremental.resources.ResourcesBuilder.copyResource(ResourcesBuilder.java:117)
at org.jetbrains.jps.incremental.resources.ResourcesBuilder.lambda$build$0(ResourcesBuilder.java:63)
at org.jetbrains.jps.incremental.fs.BuildFSState.processFilesToRecompile(BuildFSState.java:368)
at org.jetbrains.jps.incremental.IncProjectBuilder$3.processDirtyFiles(IncProjectBuilder.java:1032)
at org.jetbrains.jps.incremental.resources.ResourcesBuilder.build(ResourcesBuilder.java:52)
at org.jetbrains.jps.incremental.resources.ResourcesBuilder.build(ResourcesBuilder.java:26)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTarget(IncProjectBuilder.java:1037)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1018)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1074)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:968)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:797)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:375)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:135)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:229)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
每次运行构建过程时,都会重新创建out文件夹中的文件。
答案 0 :(得分:0)
解决此问题的解决方法是从所有测试源文件中删除只读标志。