Thank you, Mr vampire, you are always kind to our beginners. May I ask a further question, if it does not bother you.
“How to import a gradle-plugin project into another project as its plugins dependecies”
And sorry, it is too long to read. I tried my best.
Here is the thing.
I have a multiple-project which organized by includeBuild which I learned from the gradle page composite builds. I thought it is a fresh new idea and it may improve my project structures.
Here is my project structure:
- root
- build-plugin
- build-sprict-advance
- library-shared
- library-advanced
Let me explain this.
- build-plugin: a
java-gradle-pluginproject with self-define gradle plugins - build-sprict-advance: a
kotlin-dslproject usingbuild-plugin’s plugin with some default settings, which will used by other library project. - library-shared: a
javaproject, usingbuild-sprict-advance - library-advanced: another
javaproject, usingbuild-sprict-advance
The baisc idea is, I want to write some plugins to share to other projects through repository, which is build-plugin. But the same time, I have some java project provided as library in this project, that needs this custom plugins too, like library-xx.
And these peojcts are sharing same build logic. So I thought I could write a kotlin-dsl project to organizes them.
Here is my problem, I don’t know how to import my custom plugins in the build-sprict-advance project. I know how to use them directly in the library project. Just write a includeBuild under settings.gradle.kts’s root, the dependecies under build.gradle.kts will be recognised.
But when I try to combine them into a kotlin-dsl project, I got confused.
I understood two things:
- a project want to use custom plugin project, it just needs to
inlucdeBuildit from thesettings.gradle.ktsfile’spluginManagementblock, beacuse this block control plugin’s dependecies. - when
kotlin-dslproject file wants to use a plugin, it must defined in thebuild.gradle.kts's dependecies, and since akotlin-dslproject is also gradle plugin project, it means I need to treat it just likejava-gradle-plugin
But I got stucked, I just don’t know how to import a java-gradle-plugin project into another java-gradle-plugin project correctly.
I know that I can use a repository to solve my problem, but that means I have to publish first, every time I changed build-plugin.
Again, thank you Mr Vampire.