Maven compile error [package org.testng.asserts does not exist]

When I try to build project via console by [mvn clean install -DskipTests] I get error. I use in my tests testNG SoftAssert and in a test class I just added an import import org.testng.asserts.SoftAssert but looks like maven does not see that package. Error from console:

package org.testng.asserts does not exist

My pom.xml looks like

<project xmlns="" xmlns:xsi=""



Such errors occur when corresponding dependency version do not have the classes you are trying to use. In this case the TestNG version 6.1.1 you are using, does not have package org.testng.asserts. Try using below version, Also, it will not give error for SoftAsserts import, if you have asked IDE to include TestNG library. This TestNG library surely is of higher version than the one you are referring from pom.xml. Try to keep same versions both in pom.xml & your IDE's testNG plugin to avoid such varying behavior.


Above version is surely working. Give it a try.

Need Your Help

How do I conditionally compile C code snippets to my Perl module?

perl swig xs

I have a module that will target several different operating systems