Eclipse — Testng references non-existing project X

2020-02-05 02:36发布

When trying to run a test as a TestNG suite, I would get a very cryptic error message saying that TestNG can't launch because it references a non-existant project. I think my project does exist, I see it in the package explorer!

9条回答
劫难
2楼-- · 2020-02-05 03:28

It turns out you just have to make sure your project is a Java Project, and not a Simple project. Check that the navigator shows a little blue 'J' associated with the folder. If not, then you have created a Simple project.

"It would appear that the project you created is not Java project.

Eclipse auto-builds the .java file to .class files for all .java files contained in a Java project.

To create a Java project File>New>Project>Java Project Give the project a name. Click Finish"

Found this answer hidden deep in this source.

In eclipse you should be using Navigator and not Package explorer, as navigator is browsing the actual filesystem, where package explorer is loading certain things only. In the future hopefully people can find the solution more easily.

查看更多
Melony?
3楼-- · 2020-02-05 03:28

In my case, the error occurred in a Scala project. It had installed the eclipse plugin, but it had not been used yet.

Diagnostics: If all goes well, the project has a blue S for scala project. If not, it has a yellow PC mouse (for whatever that means).

To fix, you need to

sbt eclipse

on the command-line. Eclipse recognizes it as Scala project at the latest on restart.

查看更多
SAY GOODBYE
4楼-- · 2020-02-05 03:30

Solved in a different way for the same issue.

1) Go to Project->properties.

2) In properties window's left pane select "Project Facets".

3) Then click on "Convert to faceted form"

4) Then choose your server and JDK version.

Apply and Close.

Note: Verify the project and the default IDE JRE is same version.

查看更多
登录 后发表回答