[jboss-jira] [JBoss JIRA] (DROOLS-1084) kjar maven dependencies are downloaded even if scope is set to provided or test

Lindsay Thurmond (JIRA) issues at jboss.org
Tue Mar 8 07:39:00 EST 2016


Lindsay Thurmond created DROOLS-1084:
----------------------------------------

             Summary: kjar maven dependencies are downloaded even if scope is set to provided or test
                 Key: DROOLS-1084
                 URL: https://issues.jboss.org/browse/DROOLS-1084
             Project: Drools
          Issue Type: Bug
    Affects Versions: 6.3.0.Final
            Reporter: Lindsay Thurmond
            Assignee: Mark Proctor
         Attachments: debug1.png, debug2.png, debug3.png

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:
{code}
private KieModule checkClasspathForKieModule(ReleaseId releaseId) {
    // TODO
    // ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    // URL url = classLoader.getResource( ((ReleaseIdImpl)releaseId).getPomPropertiesPath() );
    return null;
}
{code}
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.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list