7

I'm debugging a Maven project in IntelliJ and I'm trying to figure out how to step into the source of one of my dependencies that's specified in my pom.xml. Specifically, my project has a dependency on Crawler4J I'm seeing some weird behaviour from Parser.parse(), and I want to step thru that method. I tried setting up a local cloned Git repo with the source and attaching it via the Sources option under Project Structure, but I still can't step into the compiled Crawler4J methods. As a long time C# developer (and relative Java nub) what I would have ideally liked is something like .NET Reflector's functionality for decompiling on the fly while debugging, but a way to attach the source would suffice.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Tyson
  • 1,685
  • 15
  • 36
  • 1
    With IntelliJ's maven support you can download and attach the sources on-the-fly - this should work out of the box. Did you import the project as a maven project (so that Idea nows about the pom)? – dratewka May 27 '13 at 18:47
  • Oh, and you can also [decompile](http://plugins.jetbrains.com/plugin/7100) but downloading the original sources is a better approach for maven artifacts. – dratewka May 27 '13 at 18:49
  • Thanks! You're correct, as the answer below indicates as well. I appreciate the help. The decompile pointer may come in handy at some point as well. – Tyson Jun 04 '13 at 04:02

1 Answers1

5

I just set up the same dependency and I have no problems to download the source code.

enter image description here

Now I created a simple Main class with a Parser. I do Ctrl + Left-click and it will bring me to the Parser class.

enter image description here

As you can see it has a link in the upper right corner saying Download Sources.

enter image description here

After pressing that link the sources are downloaded and immediately available.

enter image description here

maba
  • 47,113
  • 10
  • 108
  • 118
  • 1
    Thanks, this worked for me too. For some reason I wasn't initially shown the "Download Sources" option. Appreciate the help! – Tyson Jun 04 '13 at 03:59