nebula-plugins / gradle-lint-plugin

A pluggable and configurable linter tool for identifying and reporting on patterns of misuse or deprecations in Gradle scripts.
Apache License 2.0
761 stars 88 forks source link

Task with name 'fixGradleLint' not found in root project #364

Open rajendersaini opened 2 years ago

rajendersaini commented 2 years ago

I am using https://docs.gradle.org/current/samples/sample_convention_plugins.html

my ... common-convention.gradle

` /*

plugins { // Apply the java Plugin to add support for Java. id 'java' id 'nebula.lint' }

final LombokVersion = '1.18.20'

repositories { // Use Maven Central for resolving dependencies. mavenCentral()

}

allprojects { apply plugin: 'nebula.lint' gradleLint.rules = ['all-dependency'] // add as many rules here as you'd like } dependencies { constraints { // Define dependency versions as constraints implementation 'org.apache.commons:commons-text:1.9'

}

compileOnly "org.projectlombok:lombok:${LombokVersion}"
annotationProcessor "org.projectlombok:lombok:${LombokVersion}"
// Use JUnit Jupiter for testing.
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'

}

tasks.named('test') { // Use JUnit Platform for unit tests. useJUnitPlatform() } ` BuildSrc/build.gradle

` plugins { // Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. id 'groovy-gradle-plugin' }

repositories { // Use the plugin portal to apply community plugins in convention plugins. gradlePluginPortal() }

dependencies { implementation 'com.netflix.nebula:gradle-lint-plugin:17.5.0' } `

I am getting the above error.

` > Failed to apply plugin 'nebula.lint'.

Task with name 'fixGradleLint' not found in root project`

I do not know how to fix it.

paulhundal commented 1 year ago

I am running into the same problem as of right now. Trying to sync my build.gradle file and get the error message:

> Task with name 'fixGradleLint' not found in root project

I have a very simple build file that looks like this:


plugins {
  id 'org.jetbrains.kotlin.jvm'
  id 'application'
  id "nebula.lint" version "17.8.0"
}

application {
  mainClass.set('MainKt')
}

dependencies {
  implementation(platform('org.jetbrains.kotlin:kotlin-bom'))
  implementation 'org.slf4j:slf4j-simple:1.7.10'

  testImplementation 'com.google.truth:truth:1.1.3'
  testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
  testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
  kotlinOptions {
    jvmTarget = JavaVersion.VERSION_11
  }
}

tasks.withType(Test).configureEach {
  useJUnitPlatform()
}