Hi there!
I have a problem regarding custom plugin.
Let’s assume I have a plugin which do some task. It uses some third-party libraries.
class TaskPlugin implements Plugin<Project> {
void apply(Project project) {
project.task('task') << {
println 'simple task'
}
}
}
So in order to add it to my project I have to do something like this
apply plugin: 'my-plugin'
task {
... do something
}
buildscript {
repositories {
flatDirs dir('.')
}
dependencies {
classpath ("my-group:my-plugin:my-version")
classpath ("dependency:dependency:dependency")
}
}
But my application may have already this dependencies
dependencies {
compile ("dependency:dependency:dependency")
}
What should I add to my plugin in order to get rid of those classpath ("dependency:dependency:dependency")
lines?
Also I’d like plugin to know the path of compiled files of the project (because it uses them as dependencies too), where the plugin is used, because currently I have to set it like this
It would be good if plugin was able to get the project name at least (without need to specify my_project/ or my_another_project/)
So what should I add to my plugin - some configuration or something else - that will allow me to not set path to compiled classes manually?