How to add source paths while debugging Java tests in IntelliJ Community Edition

Answered

Hello,

I am new to IntelliJ. I have installed the CE on a mac. I am debugging some Java tests and would like to step into the source code in a dependency. For this, I have manually downloaded the source code of the dependency but I understand I also need to add it to the sourcePath. basically I am looking for the equivalent of this setting in vs code:

https://code.visualstudio.com/docs/java/java-testing

  • sourcePaths: Specify the extra source paths when debugging the tests.

I tried searching online but couldn't figure it out. I am also hesitant to play around and make changes I don't understand for fear of messing up the system as I am new to it. Can someone help me out? thanks.

0
2 comments

Hi. You can enable the option to “Modify classpath” in the run configuration settings, and then add the necessary libraries in the area that appears at the bottom:

For more information on each option, see https://www.jetbrains.com/help/idea/run-debug-configuration-junit.html

0

thanks for the answer. somehow this did not work for me. there is another workaround i found though. when i tried to step into the code of a dependency, intellij decompiled the class files and showed me the decompiled code. it also showed me a button labelled choose sources… or something like that. i was able to add source paths using that button.

0

Please sign in to leave a comment.