{"id":13458753,"url":"https://github.com/j-easy/easy-rules","last_synced_at":"2025-04-23T18:54:54.098Z","repository":{"id":37445171,"uuid":"8686380","full_name":"j-easy/easy-rules","owner":"j-easy","description":"The simple, stupid rules engine for Java","archived":false,"fork":false,"pushed_at":"2024-05-29T20:13:50.000Z","size":1776,"stargazers_count":5040,"open_issues_count":86,"forks_count":1081,"subscribers_count":222,"default_branch":"master","last_synced_at":"2025-04-12T01:02:29.812Z","etag":null,"topics":["business-rules","expression-language","java","rule-engine","rules-engine"],"latest_commit_sha":null,"homepage":"https://github.com/j-easy/easy-rules/wiki","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/j-easy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-03-10T14:38:26.000Z","updated_at":"2025-04-11T05:12:05.000Z","dependencies_parsed_at":"2024-11-25T22:31:10.186Z","dependency_job_id":null,"html_url":"https://github.com/j-easy/easy-rules","commit_stats":null,"previous_names":["benas/easy-rules","easyrules/easyrules"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-easy%2Feasy-rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-easy%2Feasy-rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-easy%2Feasy-rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/j-easy%2Feasy-rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/j-easy","download_url":"https://codeload.github.com/j-easy/easy-rules/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250496948,"owners_count":21440231,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["business-rules","expression-language","java","rule-engine","rules-engine"],"created_at":"2024-07-31T09:00:56.767Z","updated_at":"2025-04-23T18:54:54.081Z","avatar_url":"https://github.com/j-easy.png","language":"Java","readme":"***\n\n\u003cdiv align=\"center\"\u003e\n    \u003cb\u003e\u003cem\u003eEasy Rules\u003c/em\u003e\u003c/b\u003e\u003cbr\u003e\n    The simple, stupid rules engine for Java\u0026trade;\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](http://opensource.org/licenses/MIT)\n[![Build Status](https://github.com/j-easy/easy-rules/workflows/Java%20CI/badge.svg)](https://github.com/j-easy/easy-rules/actions)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.jeasy/easy-rules-core/badge.svg?style=flat)](http://search.maven.org/#artifactdetails|org.jeasy|easy-rules-core|4.1.0|)\n[![Javadoc](https://www.javadoc.io/badge/org.jeasy/easy-rules-core.svg)](http://www.javadoc.io/doc/org.jeasy/easy-rules-core)\n[![Project status](https://img.shields.io/badge/Project%20status-Maintenance-orange.svg)](https://img.shields.io/badge/Project%20status-Maintenance-orange.svg)\n\n\u003c/div\u003e\n\n***\n\n## Project status\n\nAs of December 2020, Easy Rules is in maintenance mode. This means only bug fixes will be addressed from now on.\nVersion 4.1.x is the only supported version. Please consider upgrading to this version at your earliest convenience.\n\n## Latest news\n\n* 06/12/2020: Version 4.1 is out with a new module to support [Apache JEXL](https://commons.apache.org/proper/commons-jexl/) as an additional supported expression language! You can find all details about other changes in the [release notes](https://github.com/j-easy/easy-rules/releases).\n\n## What is Easy Rules?\n\nEasy Rules is a Java rules engine inspired by an article called *\"[Should I use a Rules Engine?](http://martinfowler.com/bliki/RulesEngine.html)\"* of [Martin Fowler](http://martinfowler.com/) in which Martin says:\n\n\u003e You can build a simple rules engine yourself. All you need is to create a bunch of objects with conditions and actions, store them in a collection, and run through them to evaluate the conditions and execute the actions.\n\nThis is exactly what Easy Rules does, it provides the `Rule` abstraction to create rules with conditions and actions, and the `RulesEngine` API that runs through a set of rules to evaluate conditions and execute actions.\n\n## Core features\n\n * Lightweight library and easy to learn API\n * POJO based development with an annotation programming model\n * Useful abstractions to define business rules and apply them easily with Java\n * The ability to create composite rules from primitive ones\n * The ability to define rules using an Expression Language (Like MVEL, SpEL and JEXL)\n\n## Example\n\n### 1. First, define your rule..\n\n#### Either in a declarative way using annotations:\n\n```java\n@Rule(name = \"weather rule\", description = \"if it rains then take an umbrella\")\npublic class WeatherRule {\n\n    @Condition\n    public boolean itRains(@Fact(\"rain\") boolean rain) {\n        return rain;\n    }\n    \n    @Action\n    public void takeAnUmbrella() {\n        System.out.println(\"It rains, take an umbrella!\");\n    }\n}\n```\n\n#### Or in a programmatic way with a fluent API:\n\n```java\nRule weatherRule = new RuleBuilder()\n        .name(\"weather rule\")\n        .description(\"if it rains then take an umbrella\")\n        .when(facts -\u003e facts.get(\"rain\").equals(true))\n        .then(facts -\u003e System.out.println(\"It rains, take an umbrella!\"))\n        .build();\n```\n\n#### Or using an Expression Language:\n\n```java\nRule weatherRule = new MVELRule()\n        .name(\"weather rule\")\n        .description(\"if it rains then take an umbrella\")\n        .when(\"rain == true\")\n        .then(\"System.out.println(\\\"It rains, take an umbrella!\\\");\");\n```\n\n#### Or using a rule descriptor:\n\nLike in the following `weather-rule.yml` example file:\n\n```yaml\nname: \"weather rule\"\ndescription: \"if it rains then take an umbrella\"\ncondition: \"rain == true\"\nactions:\n  - \"System.out.println(\\\"It rains, take an umbrella!\\\");\"\n```\n\n```java\nMVELRuleFactory ruleFactory = new MVELRuleFactory(new YamlRuleDefinitionReader());\nRule weatherRule = ruleFactory.createRule(new FileReader(\"weather-rule.yml\"));\n```\n\n### 2. Then, fire it!\n\n```java\npublic class Test {\n    public static void main(String[] args) {\n        // define facts\n        Facts facts = new Facts();\n        facts.put(\"rain\", true);\n\n        // define rules\n        Rule weatherRule = ...\n        Rules rules = new Rules();\n        rules.register(weatherRule);\n\n        // fire rules on known facts\n        RulesEngine rulesEngine = new DefaultRulesEngine();\n        rulesEngine.fire(rules, facts);\n    }\n}\n```\n\nThis is the hello world of Easy Rules. You can find other examples like the [Shop](https://github.com/j-easy/easy-rules/wiki/shop), [Airco](https://github.com/j-easy/easy-rules/wiki/air-conditioning) or [WebApp](https://github.com/j-easy/easy-rules/wiki/web-app) tutorials in the wiki.\n\n## Contribution\n\nYou are welcome to contribute to the project with pull requests on GitHub.\nPlease note that Easy Rules is in [maintenance mode](https://github.com/j-easy/easy-rules#project-status),\nwhich means only pull requests for bug fixes will be considered.\n\nIf you believe you found a bug or have any question, please use the [issue tracker](https://github.com/j-easy/easy-rules/issues).\n\n## Awesome contributors\n\n* [Alexey1Gavrilov](https://github.com/Alexey1Gavrilov)\n* [andersonkyle](https://github.com/andersonkyle)\n* [aston2016](https://github.com/aston2016)\n* [avakimov](https://github.com/avakimov)\n* [beccagaspard](https://github.com/beccagaspard)\n* [bpoussin](https://github.com/bpoussin)\n* [cgonul](https://github.com/cgonul)\n* [cemo](https://github.com/cemo)\n* [dagframstad](https://github.com/dagframstad)\n* [danrivcap](https://github.com/danrivcap)\n* [Desislav-Petrov](https://github.com/Desislav-Petrov)\n* [drem-darios](https://github.com/drem-darios)\n* [gs-spadmanabhan](https://github.com/gs-spadmanabhan)\n* [JurMarky](https://github.com/JurMarky)\n* [jordanjennings](https://github.com/jordanjennings)\n* [kayeight](https://github.com/kayeight)\n* [khandelwalankit](https://github.com/khandelwalankit)\n* [lranasingha](https://github.com/lranasingha)\n* [laurikimmel](https://github.com/laurikimmel)\n* [mrcritical](https://github.com/mrcritical)\n* [paulbrejla](https://github.com/paulbrejla)\n* [richdouglasevans](https://github.com/richdouglasevans)\n* [ruanjiehui](https://github.com/ruanjiehui)\n* [spearway](https://github.com/spearway)\n* [stefanbirkner](https://github.com/stefanbirkner)\n* [toudidel](https://github.com/toudidel)\n* [vinoct6](https://github.com/vinoct6)\n* [wg1j](https://github.com/wg1j)\n* [will-gilbert](https://github.com/will-gilbert)\n* [WayneCui](https://github.com/WayneCui)\n* [sanmibuh](https://github.com/sanmibuh)\n* [shivmitra](https://github.com/shivmitra)\n* [zhhaojie](https://github.com/zhhaojie)\n\nThank you all for your contributions!\n\n## Easy Rules in other languages\n\n* [EasyRulesGo](https://github.com/CrowdStrike/easyrulesgo) : A port of EasyRules to Golang by [@jiminoc](https://github.com/jiminoc)\n* [EasyRulesGroovy](https://github.com/will-gilbert/easyrules-tutorials-groovy) : A port of EasyRules tutorials to Groovy by [@will-gilbert](https://github.com/will-gilbert)\n* [EasyRulesCsharp](https://github.com/feldrim/EasyRulesCsharp) : A port of EasyRules to CSharp (WIP) by [@feldrim](https://github.com/feldrim)\n\n## Who is using Easy Rules?\n\n* [Apache Nifi](https://nifi.apache.org) (see [Nifi EasyRules Bundle](https://github.com/apache/nifi/tree/rel/nifi-1.12.1/nifi-nar-bundles/nifi-easyrules-bundle))\n* [Open Remote](https://openremote.io) (see [build.gradle](https://github.com/openremote/openremote/blob/v1.0.4/model/build.gradle#L27))\n* [Open Smart Register Platform](http://smartregister.org) (see [build.gradle](https://github.com/OpenSRP/opensrp-client-anc/blob/v1.5.0/opensrp-anc/build.gradle#L196))\n* [Toad Edge by Quest](https://support.quest.com/fr-fr/technical-documents/toad-edge/2.1/user-guide/14)\n* [Extreme Networks](https://cloud.kapostcontent.net/pub/c4c24aae-b82d-44e4-8d86-01c235e4b40f/open-source-declaration-for-extr-xmc-8-dot-5)\n\n## Credits\n\n![YourKit Java Profiler](https://www.yourkit.com/images/yklogo.png)\n\nMany thanks to [YourKit, LLC](https://www.yourkit.com/) for providing a free license of [YourKit Java Profiler](https://www.yourkit.com/java/profiler/index.jsp) to support the development of Easy Rules.\n\n## License\n\nEasy Rules is released under the terms of the MIT license:\n\n```\nThe MIT License (MIT)\n\nCopyright (c) 2021 Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","funding_links":[],"categories":["Java","Recently Updated","Full fledged product","Projects","\u003ca name=\"Java\"\u003e\u003c/a\u003eJava"],"sub_categories":["[Mar 09, 2025](/content/2025/03/09/README.md)","Business Rules Engine"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-easy%2Feasy-rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fj-easy%2Feasy-rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fj-easy%2Feasy-rules/lists"}