简体   繁体   中英

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:

全球图书馆

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

导入库

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...).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM