Search code examples
javaeclipsegradleeclipse-plugin

Eclipse project build-path -- conflicting error


Eclipse is giving an error to build-path of the Gradle project on it --

Cannot nest '/src/test/resources' inside /src/test'. To enable the nesting exclude 'resources/' from '/src/test'

So I do what it asks – both of these two --

  1. by the solution here https://discuss.gradle.org/t/how-can-i-declare-an-exclusion-on-my-source-folder/22821 added exclude 'src/test/resources' into the Java srcDirs in the sourceSets> .. >java block already there is in the build.gradle file of the project,

  2. and via Eclipse—made it exclude the /test/resources' from the build-path, just as it asks.

But I sill see the error on the build-path.

Cleared the project name-s in the image

EDIT: image shows way after applying the changes i made-- a latter open of the source/edit window. i'm a Java eng of many yrs. just new on Gradle.

Is this a mismatch on the Eclipse/Buildship plugin and the Gradle version? Not savvy on Gradle/yet, but looks like Gradle isn’t backward compatible. Versions are:

  • Buildship Gradle Integration 3.0
  • Eclipse 2020-06
  • Gradle 5.5
  • Java 11

I imported as a Gradle project.

TIA


Solution

  • The problem is that you have the source folder src/test/ and another source folder src/test/resources inside/nested in the first source folder. Nesting source folders does not make sense and is therefore not allowed. Hence the error message.

    Instead, you should have the source folders src/test/java and src/test/resources for your test code and for your test resources.