void () { final String manifestText1 = "Manifest-Version: 1.0\r\nMain-Class: A\r\n\r\n"; final String manifest = createFile("d/MANIFEST.MF", manifestText1); final JpsArtifact a = addArtifact("a", root().archive("a.jar").dir("META-INF").parentDirCopy(manifest).fileCopy(createFile("a.txt"))); buildAll(); assertOutput(a, fs().archive("a.jar").dir("META-INF").file("MANIFEST.MF", manifestText1).file("a.txt")); final String manifestText2 = "Manifest-Version: 1.0\r\nMain-Class: B\r\n\r\n"; change(manifest, manifestText2); buildAll(); assertDeletedAndCopied("out/artifacts/a/a.jar", "d/MANIFEST.MF", "a.txt"); assertOutput(a, fs().archive("a.jar").dir("META-INF").file("MANIFEST.MF", manifestText2).file("a.txt")); buildAllAndAssertUpToDate(); delete(manifest); buildAll(); assertDeletedAndCopied("out/artifacts/a/a.jar", "a.txt"); assertOutput(a, fs().archive("a.jar").dir("META-INF").file("a.txt")); }