Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global libraries in Intellij IDE

I have added a Java library in the Intellij IDE, but every time I start a new Java project I can't import this library, and have to set it up over again.

This is a screenshot from Intellij Project Structure:

Global Library

The library is there, but when I try to import it I get an error:

Importing library

like image 476
Arash Saidi Avatar asked Aug 13 '14 11:08

Arash Saidi


1 Answers

Setting up a Global Library ensures that the library is defined, however it is not automatically added as a dependency to new projects.

You must go into Project Structure -> Modules, click the Dependencies tab and press the green + to add it to your project.

Or, instead, (and if IntelliJ is smart enough) after hitting F2 to navigate to one of the compile errors in your source code, Alt-enter might allow a quick fix to add the dependency (you'd have to try it...).

like image 80
vikingsteve Avatar answered Sep 23 '22 11:09

vikingsteve