Arne Burmeister
Arne Burmeister

Reputation: 20604

How to assign sources to Ivy library in IntelliJ IDEA?

I created a Webapp with an Ant/Ivy build using Spring framework and imported the project into IntelliJ IDEA. Using the IvyIDEA plugin the dependencies are resolved and a library with the jars is created automatically by the plugin.

How can I assign the sources (they are downloaded and stored in the ivy cache) to the Idea library so I can just click on a class of a dependency to browse the source?

Upvotes: 0

Views: 8011

Answers (2)

Nicola Ben
Nicola Ben

Reputation: 11367

To see ivy's cache libs I did these steps:

1) Add library folder (Choose Java from + menu):

Add .ivy2.cache folder

2) "cache" item will be added to libraries. Choose all modules of your project that should now see "cache" library (you could also add inside 'dependency' tab on each module)

3) now you should tell intellij to check recursively inside cache folder. To do this you must edit a file as follows:

File is located in your project folder under .idea/libraries/cache.xml

<component name="libraryTable">
  <library name="cache">
    <CLASSES>
      <root url="file://$USER_HOME$/.ivy2/cache" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
    <jarDirectory url="file://$USER_HOME$/.ivy2/cache" recursive="true" />
  </library>
</component>

recursive property must be set to 'true'

Upvotes: 3

j.l.
j.l.

Reputation: 81

It has to be explicitly enumerated in ivy.xml (at least in my Idea 11.1.5), i.e. sources are not shown for packages resolved as dependency of packages stated in ivy.xml. After introducing it is necessary to refresh modules (Tools->IvyIdea->resolve for ...). See also: https://code.google.com/p/ivyidea/issues/detail?id=92

Upvotes: 2

Related Questions