Eclipse -- Testng references non-existing project XXX, launch configuration
Asked Answered
A

14

20

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!

Antigone answered 16/4, 2014 at 17:47 Comment(0)
A
23

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.

Antigone answered 16/4, 2014 at 17:47 Comment(2)
It shows M for me i.e Maven Project. I imported it as Existing Maven Projects; did maven clean install. On launching the file I get the above mentioned error. What am I missing?Individualize
testng needs it to be a simple project, not a maven projectAntigone
G
26

I have faced the same problem while I was working with raspbian OS for raspberry pi. The problem was the java project was referencing to one of my previous project.

I resolved this problem by doing following steps.

  1. Go to Project->properties
  2. In properties window's left pane select "Run/Debug Settings".
  3. Select "Configure" and click "edit"
  4. In tab "Main" replace Project to your current project.
  5. Select "Main class" by clicking on search button(it will be your class name).
  6. Now hit OK.
Gussy answered 22/3, 2016 at 5:44 Comment(1)
In my case, I got to step #2 and saw both my project, and the name of the previous project I had been working on. I deleted the line with the previous project's name, clicked OK or APPLY enough times, and it ran. Thanks for the solution.Lutz
A
23

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.

Antigone answered 16/4, 2014 at 17:47 Comment(2)
It shows M for me i.e Maven Project. I imported it as Existing Maven Projects; did maven clean install. On launching the file I get the above mentioned error. What am I missing?Individualize
testng needs it to be a simple project, not a maven projectAntigone
R
9

I know this is an old post, but I hit this recently when I moved to using a MacBook Pro.

When I created a new Eclipse workspace and loaded all of my projects from the SCM, I got these Ant failures due to referencing an non-existing project.

The solution was not easy to discover, but the solution is simple: Change your Ant run configuration's JRE to run in the same JRE as the workspace.

You DO NOT need to change your build projects to Java projects.

Refractometer answered 16/10, 2017 at 14:12 Comment(4)
This saved my life! Thanks. I'm using ant for non java projects and the above solutions are not meaningful.Nullify
So here's my next thought. I don't want to run with the same JRE because I'd like to run multiple Ant builds in parallel. Alas, I haven't found any solutions yet.Refractometer
THANK YOU, that was it for me. <3Sphygmic
I had the same problem, this solution solved it, thanks :)Engorge
T
5

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.

Tab answered 7/11, 2017 at 23:12 Comment(0)
O
5

This issue will manifest for you if you have a test class in a current project that you are trying to run that matches a test class from the project that you either closed or deleted and had previously run unit tests against.

Chances are you have a test case from this deleted / missing or closed project. Eclipse will hide the launch configurations of deleted and closed projects but still attempts to use them when you do the 'right click on class' -> 'run-as' way to invoke a unit test.

The solution here is to unhide the problem launch configuration so you can delete it or modify it to conform to the current project.

Unhide the launch configurations of deleted and closed projects:

This is done via the dropdown menu path -> Eclipse -> Preferences -> "Run/Debug" -> Launching -> "Launch Configurations" In the "Launch Configurations" screen find the "launch configuration filters" section and uncheck the top 2 checkboxes: - "Filter configurations in closed projects" - "Filter configurations in deleted or missing projects" click the "Apply and close" button and close the popup screen.

Edit / delete the problem configuration:

open the Run -> "Run configurations" from the dropdown menu. On the left find and select the (no longer hidden) run configuration. In this configuration you can either update the project references to the current project or you can delete the configuration altogether. If you delete the run configuration eclipse will create a new one from scratch with the correct project settings when you attempt to "run as" on the current class.

Olivaolivaceous answered 2/7, 2018 at 21:51 Comment(1)
This answer is 100% true for the new version of Eclipse. I worked in old versions, and I never faced this issue. This saved me couple of days of my time. Thanks a million.Maybellmaybelle
A
4

In my case the run shortcut was referencing an old project.

Simply right clicking on the folder of the project I was trying to run and selecting my java class fixed the problem.

After that pressing the run button started working again.

Arista answered 18/10, 2016 at 18:59 Comment(0)
P
1

If its an existing project, you must have classpath and project file in project root folder to make it java project.

Sample:

<!--classpath -->
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
    <attributes>
        <attribute name="optional" value="true"/>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
    <attributes>
        <attribute name="optional" value="true"/>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
    <attributes>
        <attribute name="maven.pomderived" value="true"/>
    </attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>

<!-- .project  -->
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>testProject</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
    <buildCommand>
        <name>org.eclipse.jdt.core.javabuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>org.eclipse.m2e.core.maven2Builder</name>
        <arguments>
        </arguments>
    </buildCommand>
</buildSpec>
<natures>
    <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>

Pseudohemophilia answered 20/2, 2015 at 17:30 Comment(0)
L
0

It doesn't have to be a Java Project, it could be a Maven one as well. There could be a reference problem with the oldest version of the project. Please try deleting the oldest version from your Eclipse workspace, and then change your reference point.

Laroy answered 10/4, 2018 at 15:54 Comment(0)
B
0

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.

Bibliology answered 31/1, 2019 at 10:11 Comment(0)
D
0

I resolved the issue, follow the below steps:

Right Click on Feature file> Run configurations>check for the feature path and classpath .. It was taking path of previous project. Resolved the issue after selecting current project

Disjoint answered 2/7, 2020 at 7:7 Comment(0)
M
0

I also got the same problem but solved it just by deleting test runner. Go to file-->Properties-->Run/Debug Setting -->click on test runner and delete it. After this step your eclipse starts working normally as it was before!.

Mons answered 9/7, 2020 at 14:2 Comment(0)
R
0

I got this issue when I imported the non maven project to my local workspace from our project repository Configure build path was also disabled. This is because the nature of the project was not set to java. Right click on your project->select properties->Project Natures->Select Java. This will enable build path and you can add all the dependencies which will resolve the issue

Respirable answered 13/4, 2022 at 13:17 Comment(0)
R
0

I faced this issue when I imported the project into local from the repo. Reference library was disabled and was not allowing me to add external jars. I opened project properties(Right click on project->Properties) and added Java as the nature of the project. It worked!

Respirable answered 21/4, 2022 at 19:52 Comment(0)
M
0

In my case, the following resolved my issue

Right click on Project-> properties

Click "Add"In properties window's left pane select "Project Natures".

Under "Select a Nature to add to the Project", add "J Java"

Muskogean answered 14/4, 2023 at 22:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.