Trying to write a custom rules module for an andro...
# detekt
t
Trying to write a custom rules module for an android app. • It’s in a separate, kotlin only gradle module. • Depending on it in the app with
detektPlugins project(":carters-detekt")
and assembling my module before running detekt • My META-INF seems to be set correctly
src/main/resources/META-INF/services/io.gitlab.arturbosch.detekt.api.RuleSetProvider
But I’m getting this error
io.gitlab.arturbosch.detekt.api.RuleSetProvider: Provider com.carters.retail.detekt.CartersRuleSetProvider not found
which is the exact The package matches, the folder structure matches, the group matches. What other weirdness should I check that could be wrong?
g
Mmmm that’s odd. I’d call
:carters-detekt:assemble
and try to unzip the jar in the
build
folder to see if the META-INF file and the .class files are there
t
yeah it beats me…
Ok actually I may have just figured it out. I think it’s a versioning issue. The formatting plugin was on 20 RC1 while everything else was on 19
And now I can’t reproduce it anymore with the old number. I’m guessing it was just a caching issue. 🤔
Definitely caching. Got my plugin to load and having a hard time getting the app to recognize any updates I do, even after a clean and deleting all the build folders, or with --rerun-tasks. The only thing I have found to reliably trigger a refresh of my plugin source is changing the version of detekt used. I’m going to keep playing around with it, maybe it’s an IDE thing and I need to run it from CLI gradle?
Yes CLI works perfect. Whenever I edit the plugin, I need to force a gradle sync if I want to run the new version of the plugin via IntelliJ’s Gradle
Ok I take that back, it must have worked in the CLI because of a new Daemon instance. Running with
--no-daemon
seems to do the trick
g
maybe it’s an IDE thing and I need to run it from CLI gradle?
Never heard anything about this 🤔 I would try with a
./gradlew --stop
to make sure Gradle is not caching older classloaders.
t
Good call, I'll try that next. The only thing that's working for me now is --no-daemon
Required both for ide and cli
g
I think that could be needed while you develop your common extension. But once you’re “done” with it, it should work with the daemon
t
Yeah that lines up with my experience. If I change the detekt extension I need to restart the daemon
But as long as the extension stays the same, I'm good
👍 1