Sometimes when you develop larger grails projects and you have subcomponents in different jar files or grails plugins, and you wish to debug from one project into another, it’s nice to be able to point out the correct source code for one version of a Jar file.

It’s common that you release more versions of a jar file, put in a repository like artifactory or bin tray, along with it’s sources jar just beside the binary jar. This will make intellij automatically add the sources jar to the source path of your project.

But what it doesn’t do is clean up the older version, so say you for example had a dependency to my-cool-library.1.3.8  and you change it to my-cool-library-1.3.9 then intellij would fetch the new sources BUT it would still keep the old ones, so when you navigate to source of a jar, for example when debugging, it would navigate to the previous version source files. Pretty annoying.

But you can clean it up yourself. Just.

Choose : File->Project Structure

Choose : Modules tab

Find your Grails User Library -> Right click and choose Edit

Scroll down to Sources section

There you will find all the versions of your source jars that IntelliJ has added automatically, just remove the earlier versions, and there you go… you now have the correct sources jar for your favourite library and can navigate correctly to this during debug.

Checkout the screenshot here where I have my double jars.

 

And here you can see I have two jars called : odata-1.3.7-sources.jar and odata-1.3.8-sources-jar