简体   繁体   中英

External Jar is not visible from classes under a package

I have an external.jar in my maven project running with IntelliJ. My class1 cannot resolve my external.jar until I remove it out from package1 . Could you please suggest me a best practice in order to solve such a problem by keeping the folder structure as below.

mvn -v : Apache Maven 3.6.0, Java version: 1.8.0_212
Folder Structure:
-src
--test

---java
----package1
-----class1
----package2

---resources
----external.jar

-target
-External Libraries

Steps for adding external jars in IntelliJ IDEA as follows.

  1. Click File from the toolbar
  2. Project Structure ( CTRL + SHIFT + ALT + S on Windows/Linux, + ; on Mac OS X)
  3. Select Modules on the left panel
  4. Dependencies tab
  5. + → JARs or directories
  6. Select a library you want to add and click Add Selected at the bottom of the dialog

Please refer this official document from IntelliJ.

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