Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Element "systemPropertyVariables" not allowed here in intellij IDEA

I am getting above error in my pom. I can build the project successfully using maven but intellij gives above error and shows that part in the pom in red. Bellow is my section in the pom. Any idea on this?

<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>
like image 960
Jayanga Kaushalya Avatar asked Mar 29 '16 05:03

Jayanga Kaushalya


1 Answers

I suspect the problem for anyone who finds this is that IntelliJ comes with a bundled version of maven and doesnt actually use your local installion unless you ask it to. The version chain of IntelliJ -> Bundled Maven -> Surefire is what is causing it to recognize this as a problem.

There are two ways to solve this:

  • IntelliJ settings - > Build -> Build Tools -> Maven - Then change the maven home directory setting.
  • Specifiy explicitly the version of surefire you are using (has to be later than 2.13 as per http://maven.apache.org/surefire-archives/surefire-2.13/maven-surefire-plugin/examples/system-properties.html)
like image 65
MortusUK Avatar answered Nov 09 '22 13:11

MortusUK