Eclipse项目构建路径 – 冲突错误

huangapple go评论84阅读模式
英文:

Eclipse project build-path -- conflicting error

问题

Eclipse在Gradle项目的构建路径上出现错误 - 无法在<project-name>/src/test中嵌套'<project-name>/src/test/resources'。要启用嵌套,请从'<project-name>/src/test'中排除'resources/'。

所以我按照它的要求做了以下两件事 -

  1. 根据此解决方案 https://discuss.gradle.org/t/how-can-i-declare-an-exclusion-on-my-source-folder/22821,已将exclude 'src/test/resources'添加到项目的build.gradle文件中的sourceSets > .. > java块中,该块已存在。

  2. 通过Eclipse - 就像它要求的那样 - 从构建路径中排除了'/test/resources'。

但是我仍然在构建路径上看到错误。

清除了图像中的项目名称

编辑:图像显示了应用我所做的更改后的方式 - 打开源代码/编辑窗口的后来情况。我是多年的Java工程师,但对Gradle还不熟悉。

这是否是Eclipse/Buildship插件与Gradle版本不匹配的问题?对Gradle还不熟悉,但看起来Gradle不向后兼容。版本如下:

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

我将其导入为Gradle项目。

TIA

英文:

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

> Cannot nest '<project-name>/src/test/resources' inside <project-name>/src/test'. To enable the nesting exclude 'resources/' from '<project-name>/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 &#39;src/test/resources&#39;
    into the Java srcDirs in the sourceSets&gt; .. &gt;java block already there is in the build.gradle file of the project,

  2. and via Eclipse—made it exclude the /test/resources&#39; 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

答案1

得分: 0

问题在于您有源文件夹**src/test/以及第一个源文件夹内/嵌套的另一个源文件夹src/test/resources**。嵌套源文件夹没有意义,因此不允许。因此出现了错误消息。

相反,您应该为测试代码和测试资源使用源文件夹src/test/javasrc/test/resources

英文:

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.

huangapple
  • 本文由 发表于 2023年7月7日 03:12:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76631899.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定