Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
165 views
in Technique[技术] by (71.8m points)

java - IntelliJ external library dependence within packages

Within an IntelliJ project, I have set up a dependence on an external library (project structure -> Modules -> Dependencies -> Add -> Library). This library appears in the "External Libraries" tab on the left.

For classes which are placed directly in the src directory this works fine.

However, for packages I create within the project, IntelliJ doesn't recognize functions from the external library (I get a red line and a "cannot resolve symbol").

How should I set up the external library so that this issue is resolved?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
  1. Open the Project Structure dialog (e.g. Ctrl+Shift+Alt+S).

  2. In the left-hand pane of the dialog, select Modules.

  3. In the pane to the right, select the module of interest.

  4. In the right-hand part of the dialog, on the Module page, select the Dependencies tab.

  5. On the Dependencies tab, click add and select Jars or directories.

  6. In the dialog that opens, select the necessary files and folders. These may be individual .class, .java, .jar and .zip files, and the directories containing such files. Click OK.

  7. If necessary, select the Export option and change the dependency scope.

8.Click OK in the Project Structure dialog.

Source


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...