Multi application project with custom tasks/plugins written in Java

Hello,

I’m trying to structure my project as a multi application project. I’d like to mention that I’m really new to gradle and still have some problems grasping some of the concepts. So please correct me if I’m wrong.

I’ve used gradle init to create the project structure according the getting started guide Creating Multi-project Builds

If I understand it correctly the folder buildSrc is basically an own Gradle project (because it has a build.gradle(.kts) file). The build.gradle file has kotlin-dsl plugin loaded and defines the gradlePluginPortal() repository. The init process also created the folder src/main/kotlin where conventions are defined. The way I understand this is that I basically could create Kotlin code in this folder to create plugins and they’ll be loaded automatically in the main build.

But what I’d like to do is instead of using Kotlin to define those Plugins with Java. Which as far as i know is possible. I’ve already found some examples in the Gradle Docs like Authoring Tasks (gradle.org).

So I’ve copy pasted the example to the exact path. And tried to run it but I’m getting the error that the task is not found.

I don’t know what to look for and where to read about that. I’m already reading the entire documentation but somehow I’m missing something.

I’ll appreciate your feedback and comments.
Thanks!

Could you share your project or prototypes on something like Github? I think seeing what you have will make it a lot easier to diagnose.

1 Like

Hey,
thanks for replying and sorry for my late reply.
I’ve got a really busy schedule right now but I’ll prepare something and post it here.

Not only an own project, a complete own multi-project build.

They are automatically added to the class path of the main build scripts, but you still have to apply the plugins you want to apply where you want them applied.

Yes, this is possible.

I think what you miss is, that you still have to apply the plugin you write. :slight_smile: