Template project for Gradle plugin.
- Clone this repository or download as a ZIP file.
If you choose cloning, remove.git
directory and initialize repository again (git init
). - Rename project directory to your plugin name. (e.g. gradle-awesome-plugin)
- Configure some codes to identify your plugin and to fit your requirements. See the following section for details.
- Gradle wrapper is included.
- Plugins to develop plugin are already defined.
- Source directories are prepared to write codes in Groovy. See
src/main/groovy
directory.
- Simple JUnit test codes are prepared. By executing
./gradlew test
, test will be executed.- Report file location:
build/reports/tests/index.html
- Report file location:
- Cobertura coverage report is prepared. By executing
./gradlew cobertura
, coverage report will be generated.- Report file location:
build/reports/cobertura/index.html
- Report file location:
.editorconfig
file for EditorConfig is included to keep clean format.
You can publish plugin easily to Maven Central via Sonatype and to Gradle Plugin Portal.
./gradlew uploadArchives
will publish artifacts to local directory(defaults torootDir/.repo
).
-
./gradlew uploadArchives -Prelease
will publish artifacts to Sonatype repository.You must create an account and your repository on Sonatype.
-
When the version has
-SNAPSHOT
suffix,./gradlew uploadArchives -Prelease
will upload artifacts to snapshot repository and your plugin can be used by anyone instantly. -
When the version does NOT have
-SNAPSHOT
suffix,./gradlew uploadArchives -Prelease
will upload artifacts to release repository. After executing it, you should release manually atoss.sonatype.org
.
./gradlew clean build publishPlugins
will publish artifacts to Gradle Plugin Portal.
.travis.yml
is prepared in case you use Travis CI.
appveyor.yml
is prepared in case you use AppVeyor.
Edit the Gradle version of the distributionUrl
in gradle/wrapper/gradle-wrapper.properties
.
Edit gradle/meta.gradle
.
This file defines meta information such as version, package name, repository URL, etc.
-
Rename package, classes in the
src/main/groovy
directory.
You should do it with IDE's refactoring features. -
Fix TODOs in the Groovy source codes.
-
Rename
com.example.template.properties
inresources/META-INF/gradle-plugins
directory toyour.plugin.id.properties
.What the package name and ID should be is described in the Gradle user guide.
Edit README.template.md
and move it to README.md
.
This document (README.md
) is NOT a part of the plugin template files.
If you choose a license other than Apache License v2, please remove LICENSE
and add appropriate notice document.
Set the following credential properties in the $USER_HOME/.gradle/gradle.properties
or projectRootDir/gradle.properties
.
DO NOT add these properties to the version control.
These values are required to publish plugin to Maven Central via Sonatype OSSRH. See OSSRH Guide for details.
signing.keyId=XXXX
signing.password=XXXX
signing.secretKeyRingFile=XXXX
ossrhUsername=XXXX
ossrhPassword=XXXX
These values are required to publish plugin to Gradle Plugin Portal.
./gradlew login
will generate them.
See here for details.
gradle.publish.key=XXXX
gradle.publish.secret=XXXX
Star this project if you like it ;)
Now you're ready to write and publish your awesome plugin!
Copyright 2015 Soichiro Kashima
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.