如何解决即使添加到Maven Project后也无法找到/导入“ io.rest-assured”软件包
我将以下依赖项添加到了maven项目pom.xml文件中,并进行了mvn清洁,安装。我可以在我的C驱动器/用户中看到添加到.m2文件夹的依赖项,但是它们未在IntelliJ“外部库”部分下列出。另外,当我尝试将它们导入到班级时,我没有看到它们,并且出现“未找到”错误。
已添加依赖项-
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-path</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>4.3.0</version>
</dependency>
解决方法
我认为可能是因为缺少<scope>
。默认范围是compile
,如果未指定,则使用默认范围,但是我们在这里需要test
。
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-path</artifactId>
<version>4.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>4.3.1</version>
<scope>test</scope>
</dependency>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。