I’m attempting to clean up an existing gradle plugin. This is how a task is currently created, and I’m trying to move the task into a separate class.
project.task('createScmAdapter', group: RELEASE_GROUP,
description: 'Finds the correct SCM plugin') doLast this.&createScmAdapter```
If I attempt to use the gradle syntax that is detailed here like so:
project.task('createScmAdapter', type: CreateScmAdapter.class) {
group = RELEASE_GROUP
description = 'Finds the correct SCM plugin'
}
I get this error:
* Where:
Build file '/Users/tyler.thrailkill/Documents/code/test-project/build.gradle.kts' line: 1
* What went wrong:
An exception occurred applying plugin request [id: 'net.researchgate.release', version: '2.7.1-SNAPSHOT', artifact: 'net.researchgate:gradle-release:2.7.1-SNAPSHOT']
> Failed to apply plugin [id 'net.researchgate.release']
> No such property: CreateScmAdapter for class: net.researchgate.release.ReleasePlugin
I don’t understand why it is failing to find the class, they are located in the same package.
Maybe I’m compiling something wrong? Here is the build.gradle for the plugin
//buildscript {
// ext.kotlin_version = '1.3.10'
// repositories {
// mavenLocal()
// jcenter()
// }
// dependencies {
// classpath 'org.codehaus.groovy:groovy-backports-compat23:2.4.6'
// classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// classpath 'net.researchgate:gradle-release:2.7.1-SNAPSHOT'
// }
//}
plugins {
id 'groovy'
id 'java-gradle-plugin'
id "com.jfrog.artifactory" version "4.8.1"
id "nu.studer.plugindev" version "1.0.6"
id "com.palantir.idea-test-fix" version "0.1.0"
id "nebula.kotlin" version "1.3.10"
}
//apply plugin: 'net.researchgate.release'
group='net.researchgate'
dependencies {
// compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
testCompile("org.spockframework:spock-core:$spockVersion") { exclude group: 'org.codehaus.groovy' }
testCompile "junit:junit:$junitVersion"
testCompile "org.eclipse.jgit:org.eclipse.jgit:$jgitVersion"
testCompile "cglib:cglib-nodep:$cglibVersion"
implementation 'net.researchgate:gradle-release:2.7.1-SNAPSHOT'
testImplementation gradleTestKit()
}
plugindev {
pluginImplementationClass 'net.researchgate.release.ReleasePlugin'
pluginDescription 'gradle-release is a plugin for providing a Maven-like release process to project using Gradle.'
pluginLicenses 'MIT'
pluginTags 'gradle', 'plugin', 'release'
authorId 'hillkorn'
authorName 'Dennis Schumann'
authorEmail 'dennis.schumann@researchgate.net'
projectUrl 'https://github.com/researchgate/gradle-release'
projectInceptionYear '2011'
done() // do not omit this
}
//release {
// git {
// requireBranch = '(master|\\d+\\.\\d+)'
// }
//}
bintray {
user = project.hasProperty('bintrayUser') ? bintrayUser : ''
key = project.hasProperty('bintrayApiKey') ? bintrayApiKey : ''
pkg {
repo = 'gradle-plugins'
userOrg = 'researchgate'
version {
gpg {
sign = false
}
mavenCentralSync {
sync = false
user = project.hasProperty('sonatypeUser') ? sonatypeUser : ''
password = project.hasProperty('sonatypePassword') ? sonatypePassword : ''
}
}
}
publish = false
}
artifactory {
contextUrl = 'https://oss.jfrog.org'
publish {
repository {
repoKey = 'oss-snapshot-local' //The Artifactory repository key to publish to
username = project.hasProperty('bintrayUser') ? bintrayUser : ''
password = project.hasProperty('bintrayApiKey') ? bintrayApiKey : ''
}
defaults {
publications 'plugin' // That is how it is named in plugindev plugin
properties = ['bintray.repo': 'gradle-plugins', 'bintray.package': 'gradle-release', 'bintray.version': version.toString()]
}
}
resolve {
repoKey = 'jcenter'
}
}
//afterReleaseBuild.dependsOn bintrayUpload
wrapper.gradleVersion = '1.12'
repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}