How to modify source code for external libraries

I am using the spark machine learning libraries as an external library within Intellij IDEA, and I am going through the source code but I cannot modify the source code.
It is read-only. How can I make changes to the source code of these external libraries? please help!



External libraries should be configured as the module content roots or source roots in order to be modifiable.


Could you please list the steps of doing that?


I have a maven project. I have the attached screenshot that shows the project window (for my project named kmeans222). Under the external libraries, there is the

When I debug my program, I can see the source code for the mllib library but I cannot edit it.

What steps should I exactly follow from   in order to be able to edit the source code for this mllib library? I have also attached my project structure's modules,
which has the whole project kmeans222 added as a content root. I'd very much appreciate if you could please provide me step by step detailed instructions. Thank you very much.

Screen Shot 2015-07-21 at 4.08.46 PM.png
Screen Shot 2015-07-21 at 3.59.10 PM.png

For the Maven based projects there is no easy way to modify external library sources in IDEA.

Normally you'd have to modify your pom.xml. Remove this library dependency from pom.xml and copy the sources of the library to your own project.
Or you need to checkout this library source project into a separate module and configure pom.xml to use snapshot dependency on that module.

It's really not IDE specific, find a way to organize your project so that this library source is built as a part of this project instead of using the jar dependency from the repository. If you don't know how to do it, please ask in some Maven community or at


What about for PHPStorm?  If I add it to the Directories then it expects an HTTP mapping!


There's no HTTP mapping at File | Settings | Directories.

Please clarify what do you mean.


Please sign in to leave a comment.