Maven Compilation error [package org.testng.annotations does not exist]

后端 未结 9 1371
陌清茗
陌清茗 2020-12-10 11:09

I\'m pretty new to maven and I want to run my test classes using maven. I have generated the testng.xml and I have created the POM.xml file also. But when you run the

9条回答
  •  暖寄归人
    2020-12-10 11:56

    I've got similar problem. The reason for that was "Scope" option of "testng" dependency set to "test" when "compile" was needed.

    How I fixed it (note, I used Eclipse):

    1. Open pom.xml file.
    2. Go to "Dependencies" tab.
    3. Select "testng" package and click on "Properties..."
    4. On opened screen change "Scope" option to "compile" and click "OK" to save it.
    5. Try to build your project again with "compile test" goals.

提交回复
热议问题