Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project

后端 未结 9 1485
时光取名叫无心
时光取名叫无心 2020-11-21 10:20

When creating a new Java project in IntelliJ IDEA, the following directories and files are created:

./projectname.iml
./projectname.ipr
./projectname.iws
./s         


        
9条回答
  •  -上瘾入骨i
    2020-11-21 10:35

    If you are building your project with gradle, you just need to add one line to the dependencies in the build.gradle:

    buildscript {
        ...
    }
    ...
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
    }
    

    and then add the folder to your root project or module:

    Then you drop your jars in there and you are good to go :-)

提交回复
热议问题