Missing libraries - how to import?

I'm a new user, and am starting with v13.1.2.  I am able to pull a previously-existing project from version control and import it into IDEA by either File->New Project or File->Import Project.  In either case, the actual files appear, but the Libraries tab in the Project Structure dialog box is empty.  Looking in the .ipr file, I see all of the appropriate libraries.  For some reason, IDEA isn't loading that information from the file.  (My team members are still using v12, so I don't know if that is part of the issue.)

Has anyone seen this issue before, and has some advice?  Or do I need to manually (and tediously) set up these libraries?

5 comments

I can't give an exact answer without knowing a bit more about how your project is laid out.Can you let me know the following...

  1. Is this a multi-module project?
  2. Is this a Maven or Gradle based project?
  3. If the answer to #2 is no, are all your libraries in a 'lib' directory of some sort?
  4. If you go into File > Project Structure and select "Libraries" under "Project Settings", do you see a list of your libraries?
0

Single module, not Maven or Gradle, and the libraries are in a lib directory.  (This is Windows, BTW.)  Under "Project Settings", I don't see any libraries listed - says "Nothing to show" instead of a list.

Here are some sample lines from the Projectname.ipr file.  There are all of the other libraries listed inside that first <element> tag, and all have their details in their own separate <library> tags, like I've listed for iText.

...
<element id="directory" name="lib">
...
<element id="library" level="project" name="iText 2.1.7" />
...
</element>
...
<library name="iText 2.1.7">
<CLASSES>
<root url="jar://I:/Lib/iText-2.1.7/iText-2.1.7.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
...

0

OK. It looks like during the import you missed a spot (or it was not offered for some reason) to configure the libraries. Since they are all in a single directory, its super easy to add them. Go to File > Project Structure again, but this time click on "Modules" under "Project Settings". On the "Modules" pane, select your module and click on the "Dependencies" tab. Click the add button add2.png on the far right and select "Jars or directories". In the file chooser that opens, navigate to and select your "lib" directory. Depending on the structure of the lib directory, you may get prompted to select which roots you want (i.e. sub-directories that also contain JARs).  That should do it. It will show up in the Dependencies list with a name of the file path. If yo want to rename it, select it and then click the edit edit-pencil.png button.

0

I do have all of the appropriate modules (20 of them) listed in the Dependencies tab, but they are all red.  They all read as "invalid item" - they can't be edited since there apparently isn't any information about what should be in that module (even though that is in the .ipr file).  I've tried doing some updates (recreating libraries in the Project Structure "Libraries" tab), but the changes don't get saved into the .ipr file - that seems to not get changed no matter what I do.  The .iml file gets changed fine.

0

The very strange thing is that when I recreate the libraries, they then show up as valid in the "Dependencies" tab, but there is no change in any of the configuration files (compared with the file repository) - .iml, .ips, .ipr.  Where else (what other configuration files) would this information be saved, so that I can check to see if I'm downloading it correctly?

0

Please sign in to leave a comment.