[GRADLE-3521] Incremental Java compilation of tests fails when a main source file is deleted Created: 08/Aug/16  Updated: 08/Aug/16  Resolved: 08/Aug/16

Status: Resolved
Project: Gradle
Affects Version/s: 2.14
Fix Version/s: 3.0-rc-2

Type: Bug
Reporter: Eric Wendelin Assignee: Eric Wendelin
Resolution: Fixed Votes: 0


 Description   

Reported by Google:
Removing a source file in the main sources breaks incremental compilation of the test sources.

Reproduction Steps

You just need a project with
```
build.gradle:
apply plugin: 'java'
configure([compileJava, compileTestJava])

{ options.incremental = true }

```

and two valid java files in src/main/java and one in src/test/java.
compile, and then remove one of the files from src/main/java

`gradlew build` output:
```
: Incremental java compilation is an incubating feature.
:compileJava
None of the classes needs to be compiled! Analysis took 0.006 secs.
:processResources UP-TO-DATE
:classes
:compileTestJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileTestJava'.
    > Unable to read class file: '/usr/local/google/home/cmw/sample/build/classes/main/com/example/Foo.class'
  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 0.851 secs
```



 Comments   
Comment by Eric Wendelin [ 08/Aug/16 ]

Fixed by https://github.com/gradle/gradle/commit/ec56ed01ebcf221e38cd24a0edfe9f01563a2e5c

Generated at Wed Jun 30 12:50:58 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.