grable 导入本地包 local jar

三种方式

单个文件
implementation files('libs/a.jar', 'libs/b.jar')

整目录

implementation fileTree(dir: 'lib', includes: ['*.jar'])  // 依赖lib目录下的所有以.jar结尾的文件
implementation fileTree(dir: 'lib', include: '*.jar')  // 依赖lib目录下的所有以.jar结尾的文件
implementation fileTree(dir: 'lib', excludes: ['xxx.jar'], includes: ['*.jar'])  // 依赖lib目录下的除了xxx.jar以外的所有以.jar结尾的文件

添加仓库

repositories {
    flatDir {
        dirs 'lib1', 'lib2'
    }
}

dependencies { implementation name: 'sample-jar-0.8.7' }

阿里云仓库

repositories {
    maven { url 'https://maven.aliyun.com/repository/jcenter' }
    maven { url 'https://maven.aliyun.com/repository/google' }
    maven { url 'https://maven.aliyun.com/repository/central' }
    maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
    maven { url 'https://maven.aliyun.com/repository/apache-snapshots' }
    mavenCentral()
    flatDir {
        dirs 'lib'
    }
}

跳过测试

test {
    useJUnitPlatform()
    enabled = false
}
posted @ 2023-01-17 12:59  vx_guanchaoguo0  阅读(49)  评论(0编辑  收藏  举报