jeremymailen / kotlinter-gradle

Painless, fast ktlint plugin for Gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Help] Task 'installKotlinterPrePushHook' not found in root project.

Ridje opened this issue · comments

commented

Hello.

Description
I am trying to execute installKotlinterPrePushHook automatically when someone is starting build.
Android Studio is saying build.gradle.kts:29:7: Unresolved reference: check
Generally the problem is gradle can't see installKotlinterPrePushHook task at all.

Versions
Gradle's version: 7.3.3
kotlinter-gradle version: 3.13.0

Root's build.gradle.kts

plugins {
    id("org.jmailen.kotlinter") version "3.13.0" apply false
}

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:${Versions.gradle}")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0")
        classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.navigation}")
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

tasks.register("clean", Delete::class) {
    delete(rootProject.buildDir)
}

tasks.check {
    dependsOn("installKotlinterPrePushHook")
}
Screenshot image

Module's build.gradle.kts plugins section

plugins {
    id("com.android.application")
    kotlin("android")
    kotlin("kapt")
    id("androidx.navigation.safeargs.kotlin")
    id("kotlin-parcelize")
    id("kotlin-android")
    id("org.jmailen.kotlinter")
}

Gradle sync and ./gradlew installKotlinterPrePushHook

* What went wrong:
Script compilation errors:

  Line 29: tasks.check {
                 ^ Unresolved reference: check

  Line 30:     dependsOn("installKotlinterPrePushHook")
               ^ Unresolved reference: dependsOn
./gradlew installKotlinterPrePushHook

FAILURE: Build failed with an exception.

* What went wrong:
Task 'installKotlinterPrePushHook' not found in root project ''.

* Try:
> Run gradlew tasks to get a list of available tasks.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
6 actionable tasks: 6 up-to-date

Hello.

Description I am trying to execute installKotlinterPrePushHook automatically when someone is starting build. Android Studio is saying build.gradle.kts:29:7: Unresolved reference: check Generally the problem is gradle can't see installKotlinterPrePushHook task at all.

Versions Gradle's version: 7.3.3 kotlinter-gradle version: 3.13.0

Root's build.gradle.kts

plugins {
    id("org.jmailen.kotlinter") version "3.13.0" apply false
}

buildscript {
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:${Versions.gradle}")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0")
        classpath("androidx.navigation:navigation-safe-args-gradle-plugin:${Versions.navigation}")
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

tasks.register("clean", Delete::class) {
    delete(rootProject.buildDir)
}

tasks.check {
    dependsOn("installKotlinterPrePushHook")
}

Screenshot
Module's build.gradle.kts plugins section

plugins {
    id("com.android.application")
    kotlin("android")
    kotlin("kapt")
    id("androidx.navigation.safeargs.kotlin")
    id("kotlin-parcelize")
    id("kotlin-android")
    id("org.jmailen.kotlinter")
}

Gradle sync and ./gradlew installKotlinterPrePushHook

* What went wrong:
Script compilation errors:

  Line 29: tasks.check {
                 ^ Unresolved reference: check

  Line 30:     dependsOn("installKotlinterPrePushHook")
               ^ Unresolved reference: dependsOn
./gradlew installKotlinterPrePushHook

FAILURE: Build failed with an exception.

* What went wrong:
Task 'installKotlinterPrePushHook' not found in root project ''.

* Try:
> Run gradlew tasks to get a list of available tasks.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s
6 actionable tasks: 6 up-to-date

Hello, I have encountered the same problem, how should I solve it, thank you