Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flink official demo debug will get error :Cannot find a class with the main method #478

Open
rockxsj opened this issue Nov 20, 2018 · 16 comments

Comments

@rockxsj
Copy link

rockxsj commented Nov 20, 2018

[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
  1. curl https://flink.apache.org/q/quickstart.sh | bash -s 1.6.1
  2. open the quickstart dir with vscode and press F5 to debug,will get the error:
    image
  3. if I assign the class in launch.json, I will get another error:
    image

[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
@yaohaizh
Copy link
Contributor

@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?

@andxu
Copy link
Contributor

andxu commented Nov 21, 2018

Seems a bug in eclipse maven importer not work with lifecycle-mapping plugin, to solve your problem temporarily, try to

  1. close vscode and eclipse
  2. delete .project file and .classpath file(if the root folder has)
  3. run mvn eclipse:eclipse at the root folder
  4. 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] ------------------------------------------------------------------------

@rockxsj
Copy link
Author

rockxsj commented Nov 22, 2018

tks! this workaround work well! 👍

@Zeus-Iqd
Copy link

@andxu 请问下mac要怎么做?

@andxu
Copy link
Contributor

andxu commented Nov 22, 2018

@Zeus-Iqd 是同样的项目吗?如果是的话,在pom.xml里删掉lifecycle-mapping插件,如果不是的话,可不可以attach一个你的project?

@rockxsj
Copy link
Author

rockxsj commented Nov 23, 2018

@andxu 请问下mac要怎么做?

一样的,就按照@andxu 说的做就行了,我的也是mac

@caleb1010
Copy link

@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. 🥺

@surgura
Copy link

surgura commented Nov 20, 2020

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.

@tomercagan
Copy link

tomercagan commented Dec 24, 2020

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...

@Jasonzhaochen
Copy link

I was about to give up and switch to IntelliJ IDEA. Thank you all!

1 similar comment
@xingzhuimeteorite
Copy link

I was about to give up and switch to IntelliJ IDEA. Thank you all!

@afreemanio
Copy link

Can confirm still a problem - was about to switch to IDEA or eclipse, thank you for the answer

@tasty0tomato
Copy link

tasty0tomato commented Aug 27, 2024

I have a question. Why does lifecycle-mapping influence? And maybe we should also report this to Apache Flink to make Flink better run in vscode.

I think this is the problem of this out of date Flink demo, but not java plugin. Like they use the retired Apache Maven Eclipse Plugin, which causes this problem, and they also use the deprecated API of Flink by themselves. So I think at least this issue can be closed.

@davidradl
Copy link

davidradl commented Sep 24, 2024

@tasty0tomato I am trying to get Flink to work with Visual Studio code. I cannot get this working with the current Flink demo; are you saying that this works with latest Flink demo?

@tasty0tomato
Copy link

@davidradl Please delete the lifecycle-mapping plugin in pom.xml which is used to develop in Eclipse, but seems to not work with VSCode.

@davidradl
Copy link

@tasty0tomato thanks for you quick response - I will give it a go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests