Cannot apply plugin by id using kotlin DSL

I’m unable to add a plugin using id (Kotlin DSL). Not sure if the problem is with my setup, or something else. Here is a minimal setup to reproduce the problem: https://github.com/egmanoj/plugin-problem

I get the following error:

dockerdev@localhost:~/code/plugin-problem$ ./gradlew tasks

FAILURE: Build failed with an exception.

* Where:
Build file '/home/dockerdev/code/plugin-problem/build.gradle.kts' line: 7

* What went wrong:
Plugin [id: 'com.github.sedovalx.gradle-aspectj-binary', version: '1.0.37'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.github.sedovalx.gradle-aspectj-binary:com.github.sedovalx.gradle-aspectj-binary.gradle.plugin:1.0.37')
  Searched in the following repositories:
    Gradle Central Plugin Repository
    BintrayJCenter

* Try:
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 5s

Did you add the classpath dependency? Can you share your buildScript dependencies?

(typing on my phone) I’ve linked to a github repo in the original post. Would that work for you?

My settings.gradle.kts:

pluginManagement {
    repositories {
        gradlePluginPortal()
        jcenter()
    }
}

rootProject.name = "plugin-problem"

And build.gradle.kts:

/*
 * This file was generated by the Gradle 'init' task.
 *
 * This is a general purpose Gradle build.
 * Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds
 */
plugins {
    id("com.github.sedovalx.gradle-aspectj-binary") version "1.0.37"
}

That’s all I have. I tried ./gradlew tasks, and it did not work.

You can only apply a plugin by id if it is published to the Gradle Plugin Portal or with a marker interface to an internal repository. This plugin does not meet that criteria. You will need to manually include the artifact on the buildscript classpath as indicated on the plugin’s README.

Thank you. That solved it. For future reference here are the changes I made: https://github.com/egmanoj/plugin-problem/commit/d4809fea6927cb75ff13a98b8c45b255c613e62d