首页 > 解决方案 > 在为 xml 单元创建依赖项时在 pom.xml 中出现错误

问题描述

我想比较两个XML文件,xmlunit但是在尝试在 Maven 中为相同的文件创建依赖项时,我遇到了一个错误pom.xml

我使用了下面的依赖代码,但没有下载 jar 文件。试过下面的代码pom.xml

<dependency>
<groupId> xmlunit  </groupId>
<artifactId>  xmlunit  </artifactId>
<version>1.6</version>
<scope>test</scope>
</dependency>

我想使用 maven 下载 XMLunit 的 jar 文件

标签: maven

解决方案


我不确定 groupId 和 artifactId 中的空白。我想这段代码应该可以工作:

<dependency>
  <groupId>xmlunit</groupId>
  <artifactId>xmlunit</artifactId>
  <version>1.6</version>
  <scope>test</scope>
</dependency>

使用此命令运行您的项目

mvn clean install

或者

mvn dependency:resolve

如果你想通过使用 maven 下载这个单一的依赖,运行这个命令

mvn dependency:get -Dartifact=groupId:artifactId:version

推荐阅读