This message was deleted.
# community-support
s
This message was deleted.
j
The idea is similar to the Java Library plugin but the difference is I dont want the base plugin to be brought onto the build class path transitively or applied by my plugin
t
it's possible and I do this myself. My guess without more information is that you're running into a classpath/class loader issue. How is each plugin added to the build's classpath?
j
The constraint is the user might have requirements of plugin versions. If they want to use a newer one of the dependee then I want to do nothing. If they dont want the dependee at all, I dont want to bring it along as a compile time dependency
i expect it to be used like
Copy code
plugins { 
id 'dependee' version '1.0'
id 'dependent' version '1.0'
}
or
Copy code
plugins { 

id 'dependent' version '1.0'
}
v
The order of the plugins shouldn't actually matter anyway. How do you "check for the class"? Can you show an MCVE of what you try?
j
Well if the class I need is not on the runtime build class path then a class not found error is thrown. There is no MVCE really, thats just the reality. Plugin A -> KlassA Plugin B -> KlassB -> PluginA:KlassA Then
Copy code
plugins.hasPlugin(KlassA::class.java)
fails even when the plugin has been put in the
plugins
block first
I will guard with reflection using
Class.forName
but even my real issue is that
plugins
block doesn't bring the plugin classes onto the path during the
configuration
phase
v
It should, that's why I asked for an MCVE or reproducer. 🙂 Btw. if you have a look at the JavaDoc of
plugins
(or rather
getPlugins
), you will learn that you shouldn't use it, but
pluginManager
instead. 🙂
j
oh this was written back in gradle 6? I can try upgrading
v
Also, you might consider using
pluginManager.withPlugin
to react to the other plugin getting applied even if after your plugin instead of checking with
hasPlugin
👀 1
That's longer not to be used than even Gradle 6 iirc
It is not deprecated
But the JavaDoc say "don't use this"
j
So in my plugins
apply
method i'll try to use
pluginManager.withPlugin
and see what happens
i'll have to read up on it
thanks!
v
you're welcome