4

After compiling and running successfully the Word Count examples with Maven and direct-runner, I'm looking for a way to add break point in code and to debug it step by step.

I ran this command:

mvn compile exec:java -D exec.mainClass=org.apache.beam.examples.WordCount -D exec.args="--inputFile=pom.xml --output=counts" -P direct-runner

but I can't find any other way to debug the code with IntelliJ IDE. Is it even possible to run the code in debug mode? is there any 'debug runner' ?


UPDATE

I've created an empty Maven project, added dependencies to pom.xml file and I've successfully ran the project in Debug Mode (according to this tutorial) - the importat part was the beam-runners-direct-java dependency.

I still don't know what I've done wrong in the BEAM WordCount project.

Guy P
  • 1,395
  • 17
  • 33
  • 1
    Have you tried create [Application Run/Debug Configuration](https://www.jetbrains.com/help/idea/run-debug-configuration-application.html) where to specify `org.apache.beam.examples.WordCount` as the main class and other JVM properties? – Andrey Jun 03 '19 at 12:18
  • As Andrey suggested, adjusting the run/debug configuration will do. If you run the example once from Intellij, it will create a default configuration that you can later edit to specify pipeline options and environment variables – Anton Jun 03 '19 at 15:32
  • I've tried it. set Main class to `org.apache.beam.examples.WordCount`, also added args and WorkingDir. got this error: `Error: Could not find or load main class org.apache.beam.examples.WordCount. very strange. (I've also tried this https://stackoverflow.com/questions/10654120/error-could-not-find-or-load-main-class-in-intellij-ide) build succeeded. – Guy P Jun 04 '19 at 06:11

0 Answers0