void () { String source = createFile("src/a.xml"); final File sourceFile = new File(source); assertTrue("Unable to make file readonly: ", sourceFile.setWritable(false)); JpsModule m = addModule("m", PathUtil.getParentPath(source)); rebuildAllModules(); assertOutput(m, fs().file("a.xml")); final File outputFile = new File(getModuleOutput(m), "a.xml"); assertTrue(outputFile.exists()); assertFalse(Files.isWritable(outputFile.toPath())); sourceFile.setWritable(true); // need this to perform the change change(source, "changed content"); assertTrue("Unable to make file readonly: ", sourceFile.setWritable(false)); buildAllModules().assertSuccessful(); assertTrue(outputFile.exists()); assertFalse(Files.isWritable(outputFile.toPath())); }