在 Karate DSL 框架中,IntelliJ IDE 无法使用 Gradle 找到可见的功能文件框架、功能、文件、Karate

2023-09-08 00:01:13 作者:樱桃小丸子*—

使用以下工具创建示例空手道 DSL 测试时;抛出在 [classpath: packagename] 找不到任何功能":

IntelliJ 2017.2.3摇篮 2.9

Java基础速成 4,下载IDE 如何下载Intellij

项目结构如屏幕截图所示.请注意,我在带有 Gradle 的 Eclipse Mars 4.5.2 中使用了完全相同的项目结构,但我无法复制此问题.我还将 Maven 与 Intellij 一起使用,并且没有发生此问题.

使用 Gradle 将问题隔离到 Intellij!有什么想法吗?

解决方案

我最好的猜测是 IntelliJ Gradle 不支持

When using the following tools to create a sample Karate DSL Test; a "no features found at [classpath: packagename]" is thrown:

IntelliJ 2017.2.3 Gradle 2.9

project structure is shown in screenshot. Note that I have used the exact same project structure in Eclipse Mars 4.5.2 with Gradle and I was not able to replicate this issue. I also used Maven with Intellij and this issue did not occur.

The issue is isolated to Intellij using Gradle! any thoughts?

解决方案

My best guess is IntelliJ Gradle does not honor the sourceSets tweak needed for the recommended Karate folder structure.

I just had an idea, try switching to the "traditional" Java project structure where *.feature files are in src/test/resources (not src/test/java) and that might just work.

Example project structure, from IDEA 2017.2.6 with Gradle.