Andre, In Drools5 we introduced a new module called drools-api which contains all the stable interfaces we want to expose to the end user. People who are using the new Drools5 API are encouraged to use only the public API and not cast to internal implementation classes as they might change over time (while the public api will remain stable). Eclipse automatically generates warnings if you are using some of those internal classes.
Note that, for backwards compatibility, you can still keep using the old api. In that case, those warnings don't really make sense. You can easily turn them off in that case by doing: Windows - Preferences -> select Drools on the left and change the Internal rule classes setting to accessible. A rebuild should remove all the warnings. Also note that the drools engine itself doesn't have a lot of dependencies, and that most jars are only needed if you are using specific modules. The Drools runtime simply adds all the jars in the selected runtime directory (and the lib folder). So you can define which jars should be added to the classpath by creating a folder that only contains those jars you need and pointing your Drools runtime to that directory. Kris Quoting Andre Santos <[email protected]>: > > Hello, > > I have a little piece of code I wrote to evaluate a simple fact type. > The > code is basically this: > > > RuleAgent agent = RuleAgent.newRuleAgent("/test-config.properties"); > RuleBase rb = agent.getRuleBase(); > > FactType testFact = rb.getFactType("testPackage.testFact"); > > Object factObj = testFact.newInstance(); > testFact.set(factObj, "property", "value"); > StatelessSessionResult rs = > rb.newStatelessSession().executeWithResults(new > Object[] {factObj}); > > for (Iterator i = rs.iterateObjects(); i.hasNext();) { > //... retrieve results > } > > > This code works fine, but Eclipse highlights almost all of it with > the > following warning message: > > "Discouraged access: The method newRuleAgent(String) from the type > RuleAgent > is not accessible due to restriction on required library > drools-core-5.0.1.jar" > > The same warning is issued for many objects/methods in this code. > > This only happens when I right-click my project and "Convert to > Drools > Project", and all Drools dependencies (almost 80!!) are added to the > project. If I manually add only drools-api-5.0.1.jar, > drools-core-5.0.1 and > mvel2-2.0.10.jar, no warnings are displayed. > > So the questions are: is there something wrong with this code? Am I > using > some restricted part of the API? Is it a problem with "Convert to > Drools > Project"? > > Any comments will be most welcome. > > Best regards, > > Andre > -- > View this message in context: > http://www.nabble.com/%22Discouraged-access%22-warnings-when-using-Drools-Eclipse-Workbench-tp23895099p23895099.html > Sent from the drools - user mailing list archive at Nabble.com. > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
