官方文档(java相关):https://docs.gradle.org/current/userguide/userguide.html
官方网站下载二进制包并解压
移动到自己规划的目录
解压后目录下的init.d文件夹下创建init.gradle文件
将以下内容拷贝进去
allprojects {
repositories {
maven { url 'file:///D:/soft_files/repository'}
mavenLocal()
maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" }
mavenCentral()
}
buildscript {
repositories {
maven { name "Alibaba" ; url 'https://maven.aliyun.com/repository/public' }
maven { name "M2" ; url 'https://plugins.gradle.org/m2/' }
}
}
}
使用IDEA新建gradle项目
在file>setting里做如下配置
编辑build.gradle文件
其中dependencies中的可用标签包括
As far as configurations go, the main ones of interest are:
-
compileOnly
— for dependencies that are necessary to compile your production code but shouldn’t be part of the runtime classpath -
implementation
(supersedescompile
) — used for compilation and runtime -
runtimeOnly
(supersedesruntime
) — only used at runtime, not for compilation -
testCompileOnly
— same ascompileOnly
except it’s for the tests -
testImplementation
— test equivalent ofimplementation
-
testRuntimeOnly
— test equivalent ofruntimeOnly
You can learn more about these and how they relate to one another in the plugin reference chapter.