Launch config "Error: Could not find or load main class"; class is in a dependent mvn proj [message #1799800] |
Thu, 13 December 2018 16:38 |
Cristian Spiescu Messages: 100 Registered: July 2009 |
Senior Member |
|
|
Hello,
Context:
I have "projectA" which depends on "projectB". Both are maven projects. In "projectB" there is a "com.myproj.Main" launchable class.
1) "com.myproj.Main" can be launched without problems IF the corresponding launch config references project "projectB" (in launch config properties/Main (tab)/Project (textbox). OK until now.
2) If I now modify the launch config, changing it's project to "projectA" => I get the ERROR: "Error: Could not find or load main class com.myproj.Main". This class exists in the classpath (cf. maven). However I think that the process isn't even launched.
3) If I create in "projectA" a class, say "Main1" (w/o a "main" method), and modify the launch config so that it launches "Main1" => it works.
Have you got any hints for me?
Thanks in advance.
Cristian.
[Updated on: Thu, 13 December 2018 16:39] Report message to a moderator
|
|
|
|
|
Re: Launch config "Error: Could not find or load main class"; class is in a dependent mvn [message #1799817 is a reply to message #1799810] |
Fri, 14 December 2018 08:08 |
Cristian Spiescu Messages: 100 Registered: July 2009 |
Senior Member |
|
|
Thanks for your answer.
From what I observed, the launch config does allow the main class to be somewhere on the classpath but not necessarily directly in the main project (i.e. the project specified in the launch configs properties/Main (tab)/Project (textbox).
I'm saying this because I have just tested the same configuration (i.e. projectA, projectB, in projectB: com.myproj.Main, launch config references projectA), but this time, the projects were plain Java projects, instead of Maven projects (where projectA depends on projectB via configuration in the Build Path/Projects tab).
This strengthens my feeling cf. my previous post, i.e.:
Quote:o it seems that when the target class is in the other project, the maven logic doesn't seem to do it's job, i.e. to populate the class path with entries from both the repo AND the workspace.
I think it's related to the following line in the ".launch" file:
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
|
|
|
Powered by
FUDForum. Page generated in 0.03018 seconds