-
Bug
-
Resolution: Done
-
Major
-
None
-
6.3.0.Final
-
None
-
None
-
2020 Week 01-03 (from Dec 30)
-
NEW
-
NEW
The creation of a new kbase triggers the specified rules kjar to be downloaded from the remote Maven repository. This works as expected but has the side effect of also downloading the Maven dependencies for the kjar. The problem is that it is downloading ALL the Maven dependencies even if they are specified as provided or test scope. This shouldn't happen since provided dependencies are expected to already be on the classpath and we should never need test dependencies at all during runtime at all.
I did some digging into the Drools source to and found out that
KieRepositoryImpl#getKieModule()
contains logic to check the classpath for the KieModule and if it can't find it to load everything from the Maven repo which includes downloading all the dependencies (and dependencies of dependencies and so on).
Unfortunately the code for checking the classpath is not actually implemented and looks like this:
private KieModule checkClasspathForKieModule(ReleaseId releaseId) { // TODO // ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); // URL url = classLoader.getResource( ((ReleaseIdImpl)releaseId).getPomPropertiesPath() ); return null; }
After nothing is found on the classpath everything is downloaded from Maven. You can see all the stuff that is going to be downloaded (if it's not already in your Maven repo) in
DefaultProjectDependenciesResolver#resolve() //line 159
You can even see here that the dependencies have been marked as provided, but regardless they are going to be downloaded.