【问题标题】:Rest assured 3.0.3 maven dependency in IntelliJ IDEA not working放心 IntelliJ IDEA 中的 3.0.3 maven 依赖项不起作用
【发布时间】:2018-02-22 16:12:11
【问题描述】:

我是使用 IntelliJ 的新手。我将项目结构设置为 8 级,并添加了 SDK 和必填字段。 现在在 POM 中,我有 RESTAssured 3.0.3 的 maven 依赖项 我可以看到依赖项 jar,但它在项目中不起作用。 导入本身失败。 请帮忙。

【问题讨论】:

  • 可能有助于发布您的 pom.xml 文件以查看问题可能是什么。

标签: intellij-idea rest-assured maven-dependency


【解决方案1】:

第一次安装 Eclipse 时,我遇到了同样的问题。清理对我有用,然后再次关闭并打开它。

【讨论】:

    【解决方案2】:

    可以尝试将 lib 添加到类路径,如下所示。它解决了我在添加 Maven 依赖项后导入时遇到的问题。

    【讨论】:

      【解决方案3】:

      首先清除 .m2>repository> io 文件夹中存在的所有依赖项。 io文件夹存储放心所有依赖。 启用自动导入,如果仍然无法导入,则右键单击 project>maven> reimport 。 在 pom.xml 中添加以下代码以进行依赖下载。 这将解决您的问题。

      <dependency>
              <groupId>io.rest-assured</groupId>
              <artifactId>rest-assured</artifactId>
              <version>3.0.3</version>
              <scope>test</scope>
          </dependency>
          <!-- https://mvnrepository.com/artifact/io.rest-assured/json-path -->
          <dependency>
              <groupId>io.rest-assured</groupId>
              <artifactId>json-path</artifactId>
              <version>3.0.3</version>
          </dependency>
      
          <!-- to validate that a JSON response conforms to a Json Schema -->
          <dependency>
              <groupId>io.rest-assured</groupId>
              <artifactId>json-schema-validator</artifactId>
              <version>3.0.2</version>
          </dependency>
      
          <!-- https://mvnrepository.com/artifact/io.rest-assured/xml-path -->
          <dependency>
              <groupId>io.rest-assured</groupId>
              <artifactId>xml-path</artifactId>
              <version>3.0.3</version>
          </dependency>
      

      【讨论】:

        【解决方案4】:

        在关闭并再次打开项目后,我在 IntelliJ 中首次添加依赖项时遇到了同样的问题,依赖项开始下载,几分钟后,RestAssured(4.3.0) 的所有依赖项都下载并解决了。

        【讨论】:

        • 谢谢,.. 这工作.. 虽然它看起来不合逻辑,但它就是这样工作的。所有红色符号都已更改。
        【解决方案5】:

        您应该重建或清理并重新启动您的项目。确保它会起作用。

        【讨论】:

          【解决方案6】:

          为我工作。在依赖项中,我有值为“test”的范围标记。添加相同的依赖,并将范围添加为“编译”。

          <dependency>
              <groupId>io.rest-assured</groupId>
              <artifactId>rest-assured</artifactId>
              <version>4.3.0</version>
              <scope>test</scope>
          </dependency>
          <dependency>
              <groupId>org.testng</groupId>
              <artifactId>testng</artifactId>
              <version>7.4.0</version>
          </dependency>
          <dependency>
              <groupId>io.rest-assured</groupId>
              <artifactId>rest-assured</artifactId>
              <version>4.3.0</version>
              <scope>compile</scope>
          </dependency>
          

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 2015-07-15
            • 2012-07-12
            • 1970-01-01
            • 1970-01-01
            • 2014-10-31
            • 1970-01-01
            相关资源
            最近更新 更多