Gradle 插件项目教程
gradle-pluginsA collection of Gradle plugins项目地址:https://gitcode.com/gh_mirrors/gra/gradle-plugins
1. 项目的目录结构及介绍
gradle-plugins/
├── build.gradle
├── gradle
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── settings.gradle
└── src
├── main
│ ├── groovy
│ │ └── com
│ │ └── ewerk
│ │ └── gradle
│ │ └── plugins
│ │ └── ...
│ └── resources
│ └── ...
└── test
├── groovy
│ └── com
│ └── ewerk
│ └── gradle
│ └── plugins
│ └── ...
└── resources
└── ...
目录结构介绍
build.gradle
: 项目的构建脚本,定义了项目的依赖、任务等。gradle/wrapper/
: 包含 Gradle Wrapper 的文件,用于确保项目使用特定版本的 Gradle。gradlew
和gradlew.bat
: 分别是 Unix 和 Windows 系统下的 Gradle Wrapper 启动脚本。settings.gradle
: 项目的设置文件,定义了项目的模块和仓库等。src/main/groovy/
: 包含项目的主要代码,使用 Groovy 编写。src/main/resources/
: 包含项目的资源文件。src/test/groovy/
: 包含项目的测试代码。src/test/resources/
: 包含测试所需的资源文件。
2. 项目的启动文件介绍
gradlew
和 gradlew.bat
这两个文件是 Gradle Wrapper 的启动脚本,分别适用于 Unix 和 Windows 系统。它们确保项目使用特定版本的 Gradle 进行构建,无需在本地安装 Gradle。
gradle-wrapper.properties
该文件位于 gradle/wrapper/
目录下,定义了 Gradle Wrapper 使用的 Gradle 版本和其他配置。
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3. 项目的配置文件介绍
build.gradle
该文件是项目的主要构建脚本,定义了项目的依赖、插件、任务等。
plugins {
id 'groovy'
id 'java-gradle-plugin'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.codehaus.groovy:groovy-all:3.0.9'
testImplementation 'junit:junit:4.13.2'
}
gradlePlugin {
plugins {
simplePlugin {
id = 'com.ewerk.gradle.plugins.simple-plugin'
implementationClass = 'com.ewerk.gradle.plugins.SimplePlugin'
}
}
}
settings.gradle
该文件定义了项目的模块和仓库等设置。
rootProject.name = 'gradle-plugins'
通过以上介绍,您可以更好地理解和使用 gradle-plugins
项目。希望这份教程对您有所帮助。
gradle-pluginsA collection of Gradle plugins项目地址:https://gitcode.com/gh_mirrors/gra/gradle-plugins
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考