在Intellij IDEA中不允许在此处使用元素“systemPropertyVariables”。

15

我在我的pom文件中遇到了上述错误。使用maven可以成功地构建项目,但是在IntelliJ中会出现上述错误,并将pom中的部分显示为红色。以下是我的pom中的部分内容。对此有什么想法吗?

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">  
  ...
<build>
       <plugins>
          ...
          <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-surefire-plugin</artifactId>
             <configuration>
                <systemPropertyVariables>
                   <org.ops4j.pax.url.mvn.localRepository>${settings.localRepository}</org.ops4j.pax.url.mvn.localRepository>
                   <jacoco-agent.destfile>${project.build.directory}/jacoco.exec</jacoco-agent.destfile>
                </systemPropertyVariables>
                <suiteXmlFiles>
                   <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
                </suiteXmlFiles>
             </configuration>
          </plugin>
         ...
       </plugins>
    </build>

你使用的是哪个Maven和Idea版本?在Idea和命令行中,你使用相同的Maven版本吗?你有检查过两个环境中使用的surefire版本吗? - Peter
Idea 14和maven 3.0.5。是的,它们都是相同的。我只安装了一个实例。 - Jayanga Kaushalya
Idea 2016.2也有同样的问题。@JayangaKaushalya,你解决了吗? - Ricardo van den Broek
你最终解决了这个问题吗? - vivekmore
1个回答

4
我怀疑如果有人遇到这个问题,是因为IntelliJ附带了一个maven版本,并且除非您要求使用本地安装的maven,否则实际上不会使用它。 IntelliJ -> Bundled Maven -> Surefire的版本链才导致它将其识别为问题。
解决此问题有两种方法:

我尝试了这个修复方法,第一部分是更改Maven的主目录,但是这并没有解决问题。我的问题是与Pitest有关的,不是Surefire,但是出现了类似的错误。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接