• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Maven -- TestNG import not working

 
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I wanted to use testng in my project instead of junit so i updated pom file like below:



and then i ran mvn clean install...and it successfully downloaded the testng jar file from repository. But in eclipse still it is displaying as The import org.testng cannot be resolved.
the build path of my projects is updated for only junit not for testng



In one word: though i added testng in pom in test jave files..imports are not resolved what could be the problem?
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using the m2eclipse plugin? If not you still need to manually add the JAR to your eclipse project classpath, you can edit the .classpath file for this.
 
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simply USE the m2eclipse plugin in case you don't already and it should work. After all automatic dependency management is one good reason to use Maven, so it doesn't make much sense to add JAR files manually to your classpath

Unfortunately Maven support in Eclipse isn't very good in general compared to NetBeans and IntelliJ IDEA, but TestNG definitely works nicely with the m2eclipse plugin and the TestNG plugin!

Marco
 
Karnati Sudhakar
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Martin & Marco for your replies..

I added m2eclipse plugin and it is working good.

Sorry for late reply..

 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome and I'm glad it was fixed for you!
 
Marco Ehrentreich
best scout
Posts: 1294
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome!

As I wrote above you can additionally install the dedicated TestNG plugin. With the plugin you doesn't have to execute the whole Maven lifecycle all the time and thus you get feedback from your tests much faster

Marco
 
reply
    Bookmark Topic Watch Topic
  • New Topic