[
https://issues.redhat.com/browse/DROOLS-5434?page=com.atlassian.jira.plug...
]
Magnus Larsson commented on DROOLS-5434:
----------------------------------------
[~mfusco] These problems re-appeared and I did some quick testing. I think it should have
been the *packageNameFromFolder* = getRelativePackageName( packageNameForFolder);.
Attaching an image of debug output below, _packageNameForFile_ is already containing the
correct package (read from the .drl file), but _packageNameForFolder_ contains the
spring-boot prefix, thus the warning still appears in the log. Sorry for the delayed
response, I just found it again by chance.
!image-2020-09-03-09-20-10-089.png!
Incorrect warning about file declaring wrong package
----------------------------------------------------
Key: DROOLS-5434
URL:
https://issues.redhat.com/browse/DROOLS-5434
Project: Drools
Issue Type: Bug
Components: core engine
Reporter: Magnus Larsson
Assignee: Mario Fusco
Priority: Major
Attachments: image-2020-09-03-09-20-10-089.png
I am running Drools in a Spring-Boot jar and get the following warning statement _File
'BOOT-INF/classes/com/example/test/TEST.drl' is in folder
'BOOT-INF/classes/com/example/test' but declares package
'com.example.test'. It is advised to have a correspondance between package and
folder names_. The package name in the drl file is correct, the problem is just that
_BOOT-INF.classes._ isn't considered when evaluating if printing the warning or not.
I have tracked it down to *KieBuilderImpl.java*, method *isFileInKieBase*. The last 2
lines in that method calls:
{code:java}
// packageNameForFile prints warning if package in .drl file is not same as flatted
directory structure
// Does not care about SUPPORTED_RESOURCES_ROOTS, thus prints the warning
String pkgNameForFile = packageNameForFile( fileName, folderNameForFile, !useFolders,
file );
// Does care about SUPPORTED_RESOURCES_ROOTS, so the drl file is loaded
return isPackageInKieBase( kieBase, pkgNameForFile );
{code}
As it is implemented right now, the warning might either be a false-positive (and still
get loaded), or the package is wrong (and the file is not loaded).
Voting to include the SUPPORTED_RESOURCES_ROOTS as valid prefixes when checking if the
warning should be printed.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)