Hi @nicklaskoertge,
Sorry if this has been alsready asked previously, but I am joining late on this thread, and I read quickly the context.
This is definitely the way to go. Your plugin should use sonar-java at compile time, and need it at runtime, but it should not package it.
Could it be because SonarJava is now lazy-loaded?
In the recent SonarQube versions, we have introduced a mechanism to skip downloading/loading language plugins if they are obviously useless.
- The Scanner load first non-lazy plugins
- The Scanner list the project files to analyze
- The Scanner load lazy plugins, based on files present in the project
SonarJava is lazy, and is only loaded in the second phase if java and jsp files are there.
So a simple fix for you is to also make you plugin lazy, and ensure its loading condition is at least as restrictive as plugins it depends on.
But the problem here is your plugin depends on 2 lazy Sonar plugins, so this is not a situation we support anymore. You will have to split your plugin in 2 different plugins (one for Java, one for Python).
Add
<requiredForLanguages>java,jsp</requiredForLanguages>
(you can omit jsp if you don’t analyze JSP files)
to your Java custom plugin
Add
<requiredForLanguages>py,ipynb</requiredForLanguages>
(you can omit ipynb if you don’t analyze Jupyter Notebook files)
to your Python custom plugin.