vscode-java-debug
vscode-java-debug copied to clipboard
Flink official demo debug will get error :Cannot find a class with the main method
[provide a description of the issue]
Environment
- Operating System:macos 10.14.1
- JDK version: 1.8.0_144
- Visual Studio Code version:1.29.1
- Java extension version:0.4.0
- Java Debugger extension version:0.15.0
Steps To Reproduce
- curl https://flink.apache.org/q/quickstart.sh | bash -s 1.6.1
- open the quickstart dir with vscode and press F5 to debug,will get the error:
- if I assign the class in launch.json, I will get another error:
[attach a sample project reproducing the error] attach logs
Current Result
Cannot find a class with the main method
Expected Result
Could debug well.
Additional Informations
@testforstephen I reproed issue. Also, this issue can be happened inside eclipse. You can track this on the project side.
@rockxsj Could you try to open this project on eclipse IDE to see whether the auto complete working on eclipse IDE?
Seems a bug in eclipse maven importer not work with lifecycle-mapping
plugin, to solve your problem temporarily, try to
- close vscode and eclipse
- delete .project file and .classpath file(if the root folder has)
- run
mvn eclipse:eclipse
at the root folder - open the root folder in vscode, F5 and you will be able to debug
or remove the lifecycle-mapping
plugin in pluginManagement->plugins
N:\quickstart>mvn eclipse:eclipse
[INFO] Scanning for projects...
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failure to find org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
[INFO]
[INFO] ------------------< org.myorg.quickstart:quickstart >-------------------
[INFO] Building Flink Quickstart Job 0.1
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failure to find org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
[INFO]
[INFO] >>> maven-eclipse-plugin:2.10:eclipse (default-cli) > generate-resources @ quickstart >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.10:eclipse (default-cli) < generate-resources @ quickstart <<<
[INFO]
[INFO]
[INFO] --- maven-eclipse-plugin:2.10:eclipse (default-cli) @ quickstart ---
[INFO] Using Eclipse Workspace: null
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8
[INFO] Wrote settings to N:\quickstart\.settings\org.eclipse.jdt.core.prefs
[INFO] Wrote Eclipse project for "quickstart" to N:\quickstart.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.552 s
[INFO] Finished at: 2018-11-21T15:57:50+08:00
[INFO] ------------------------------------------------------------------------
tks! this workaround work well! 👍
@andxu 请问下mac要怎么做?
@Zeus-Iqd 是同样的项目吗?如果是的话,在pom.xml里删掉lifecycle-mapping插件,如果不是的话,可不可以attach一个你的project?
@andxu 请问下mac要怎么做?
一样的,就按照@andxu 说的做就行了,我的也是mac
@andxu I'm stuck by this tiny problem for almost 3 days. Hope to see this plugin conflict fixed in the future or notified in some any to avoid vscode malfunctioning. 🥺
This bug still remains. As andxu said, removing the eclipse plugins stuff from the pom solves the problem. Big thanks, I was about to give up.
I have had the same issue (end of 2020) - failed to run/debug and no linting / code completion etc.
Manually removed the Eclipse dependency from pom.xml
, lines 168-211 (the eclipse plugin is lines 172-209 but removing it leave an empty pluginManagement/plugins
hierarchy) immediately asked to refresh the project and following that both coding support and execution worked.
Given that the documentation do not recommend using Eclipse - maybe that plugin should be removed from the template...
I was about to give up and switch to IntelliJ IDEA. Thank you all!
I was about to give up and switch to IntelliJ IDEA. Thank you all!
Can confirm still a problem - was about to switch to IDEA or eclipse, thank you for the answer