Gradle常见问题
本文不定时更新
操作环境
- win10
- idea 2019.2
- gradle 5.6.1
引入gradle插件失败
最近clone公司项目时,发现gradle插件怎么也引入不了一直报错,官网给的两种引入方式我都尝试了,错误如下。
一般引入插件有两种方式:
//传统插件引入方式
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.hidetake:gradle-ssh-plugin:2.10.1"
}
}
apply plugin: "org.hidetake.ssh"
//DSL方式引用
plugins {
id "org.hidetake.ssh" version "2.10.1"
}
错误信息:
//传统方式
No cached version available for offline mode
//DSL方式
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.hidetake.ssh:org.hidetake.ssh.gradle.plugin:2.9.1')
Searched in the following repositories:
Gradle Central Plugin Repository
说明开启了gradle脱机模式,自然就无法去下载相应的插件。
idea右侧点开gradle菜单,最上面一排工具栏中有一个关闭离线模式的按钮,如下图所示

网上说setting->Build Tool->gradle 有个offline mode的开关按钮,但我在idea中并没有找到
网友评论