maven - Intellij IDEA Cucumber 插件如果来自依赖项,则看不到步骤定义
问题描述
我在另一个工件中定义了步骤。我从当前项目的 test/java 文件夹中的那个类继承。插件显示警告“未定义的步骤参考”并且无法突出显示或导航到定义。
此处也描述了该问题:
IDEA-104610 Support Cucumber step definitions from other JARs / projects
IDEA-157652 Cucumber intellisense lost when placed stepdefinitions in external library
解决方案
Intellij IDEA(我的是 2018.3.6)实际上可以解决和突出显示这些步骤,但前提是您有带有步骤定义的源 jar。因此解决方案是使用 Maven 或其他构建工具下载源代码。
如果您拥有具有测试定义的依赖项,我还想展示如何生成源 jar:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
如果您还生成单独的测试 jar,那么:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
<execution>
<id>attach-test-sources</id>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
推荐阅读
- javascript - 将标签插入
到第二个文本框 JS - r - 如何在 gt_plt_bar() 中使用多种颜色?
- python-3.x - 如何在 discord.py 中循环播放音频文件?
- swift - Cannot convert value of type '()' to expected argument type '(Data?, URLResponse?, Error?) -> Void'
- java - 如果springboot中为null,则设置属性的默认值
- discord.js - 如何使用斜线命令制作 discord.js 音乐机器人?
- c# - 为什么是列表
.Count 一个有符号整数?可以列出 .Count 是否为负数? - javascript - IntersectionObserver 延迟脚本在浏览器控制台和 codePen 中工作,不在 WordPress 站点中
- firebase - Firebase 存储允许 Firebase 功能无需身份验证即可上传文件
- angular - Angular Material Date Range 日期过滤器不起作用。获取 '(date: Date) => boolean' 不可分配给类型 'DateFilterFn
' 错误