如何将本地.jar文件依赖项添加到build.gradle文件?因此,我尝试将本地.jar文件依赖项添加到build.gradle文件中:apply plugin: 'java'sourceSets {
main {
java {
srcDir 'src/model'
}
}}dependencies {
runtime files('libs/mnist-tools.jar', 'libs/gson-2.2.4.jar')
runtime fileTree(dir: 'libs', include: '*.jar')}您可以看到,我在这里将.jar文件添加到了ReferencedLibrary文件夹中:https:/github.com/Walnutiq/核桃/tree/version-2.3.1/ReferencedLibrary但问题是,当我在命令行上运行命令:Gradle Build时,会得到以下错误:error: package com.google.gson does not existimport com.google.gson.Gson;这是我的全部回购:https:/github.com/Walnutiq/核桃/tree/version-2.3.1
3 回答
慕虎7371278
TA贡献1802条经验 获得超4个赞
repositories { flatDir { dirs 'libs' }}dependencies { compile name: 'gson-2.2.4'}
repositories { mavenCentral()}dependencies { compile 'com.google.code.gson:gson:2.2.4'}
ibeautiful
TA贡献1993条经验 获得超5个赞
dependencies { compile fileTree(dir: 'libs', include: ['*.jar'])}
添加回答
举报
0/150
提交
取消