[BZ-1096128] fix incremental compilation of KieModules having external dependencies
(cherry picked from commit 7ac8092562dc3fafd320831f99b753e7bda6986b)