Full language support for Drools Rule Language (.drl) files in IntelliJ IDEA — grammar-based parsing, context-aware code completion, go-to-definition, real-time validation, quick fixes, and more.
The most comprehensive Drools IDE plugin available. Write Drools rules with the same level of intelligent assistance you get for Java.
If you write Drools rules in IntelliJ IDEA, you've probably noticed there's no built-in support for .drl files. No syntax highlighting, no completion, no error checking. This plugin fixes that.
Drools Rule Checker gives you:
- A proper grammar-based parser that understands DRL structure
- Code completion that knows your project's classes, methods, and fields
- Go-to-definition — Ctrl+Click on class names to jump to Java source
- Real-time validation — see errors as you type, not at deploy time
- Quick fixes — one-click solutions for common problems
Built on Grammar-Kit BNF and JFlex, the parser produces a full AST for all DRL constructs. If one rule has a syntax error, the rest of the file still parses correctly.
- Package declarations, imports, globals
- Rule blocks with attributes (salience, no-loop, agenda-group, etc.)
- When-clause patterns with fact types, binding variables, and constraints
- Conditional elements (not, exists, forall, from, collect, accumulate, eval)
- Then-clause Java/MVEL action code
- Function definitions, type declarations, queries
| Context | What's Suggested |
|---|---|
| File top level | package, import, global, rule, function, declare, query |
| Inside rule (before when) | salience, no-loop, agenda-group, ruleflow-group, timer, etc. |
| Inside when-clause | and, or, not, exists, forall, from, accumulate, eval |
| Inside then-clause | insert, update, modify, retract, delete, drools.halt |
After $variable. |
Methods and fields of the bound type |
| At type positions | Classes from project classpath with auto-import |
| Inside constraints | Bean properties of the fact type |
- Click on a class name in fact patterns, globals, or imports → navigate to Java source or decompiled class
- Click on a method/field after
$variable.→ navigate to the method or field definition on the bound type - Click on a binding variable (
$customer) → navigate to its declaration in the when-clause - Supports chained access:
$customer.address.cityresolves each segment
| Check | Severity |
|---|---|
| Missing when/then/end clauses | Error |
| Incorrect clause order | Error |
| Unresolvable class in fact pattern | Error |
| Unresolvable import | Error |
| Unbalanced parentheses in constraints | Error |
| Invalid salience value (non-numeric) | Error |
| Invalid date format in attributes | Error |
| Unresolvable global type | Error |
| Unterminated string literals | Error |
| Duplicate rule names | Warning |
| Unused binding variables | Warning |
| Duplicate imports | Warning |
| Unused imports | Weak Warning |
- Add missing import — one click to insert the import statement
- Remove unused import — clean up unused imports
- Rename duplicate rule — auto-append numeric suffix
- Add missing semicolon — insert
;at the right position - Remove unused binding — convert
$var : Type()toType()
Outline panel showing all rules, queries, functions, and declarations. Click to navigate.
Collapse rule blocks, import groups, declare blocks, queries, functions, and multi-line comments.
- Automatic bracket matching for
(),{},[] - Toggle line comments (
//) and block comments (/* */) with keyboard shortcuts
- Open IntelliJ IDEA
- Go to File → Settings → Plugins
- Search for "Drools Rule Checker"
- Click Install and restart
- Download the latest
.zipfrom GitHub Releases - Go to Settings → Plugins → ⚙️ → Install Plugin from Disk...
- Select the ZIP file and restart
package com.example.rules;
import com.example.model.Customer;
import com.example.model.Order;
global org.slf4j.Logger log;
rule "Apply Premium Discount"
salience 100
no-loop true
when
$customer : Customer(loyaltyTier == "PREMIUM", active == true)
$order : Order(total > 500.00) from $customer.getOrders()
then
double discount = $order.getTotal() * 0.20;
$order.setDiscount(discount);
update($order);
log.info("Applied 20% discount of {} to order {}", discount, $order.getId());
end
With this plugin installed, you get:
- Syntax highlighting for all elements
- Completion after
$customer.showingCustomermethods - Completion after
$order.showingOrdermethods - Ctrl+Click on
Customernavigates to the Java class - Warning if
$customeris declared but never used - Error if
Customerclass can't be resolved on classpath
- ✅ Package declarations
- ✅ Import statements (including wildcard)
- ✅ Global declarations
- ✅ Rule definitions with all attributes
- ✅ When-clause patterns and constraints
- ✅ Binding variables (
$var : Type()) - ✅ Conditional elements (not, exists, forall, from, collect, accumulate, eval)
- ✅ Then-clause Java/MVEL code
- ✅ Function definitions
- ✅ Type declarations (declare blocks)
- ✅ Query definitions
- Java 17+
- Gradle 8.0+ (wrapper included)
- IntelliJ IDEA 2024.2+ (for running/debugging)
git clone https://github.com/MohitPimoli/drool-rule-checker.git
cd drool-rule-checker
# Build the plugin
./gradlew clean buildPlugin
# Run in a sandboxed IDE for testing
./gradlew runIde
# Run tests
./gradlew testsrc/main/
├── grammars/
│ ├── Drools.bnf # Grammar-Kit BNF grammar
│ └── Drools.flex # JFlex lexer specification
├── gen/ # Generated parser and PSI classes
├── java/com/plugin/drool/
│ ├── DroolsLanguage.java
│ ├── DroolsParserDefinition.java
│ ├── DroolsLexerAdapter.java
│ ├── DroolsAnnotator.java # PSI-based validation
│ ├── DroolsCompletionContributor.java # Context-aware completion
│ ├── DroolsReferenceContributor.java # Go-to-definition
│ ├── DroolsStructureViewFactory.java # Outline panel
│ ├── DroolsFoldingBuilder.java # Code folding
│ ├── DroolsResolutionCache.java # Class resolution cache
│ ├── util/
│ │ └── DotAccessExpressionResolver.java # $-binding expression reconstruction
│ ├── psi/mixin/ # Typed PSI mixins
│ └── fixes/ # Quick-fix actions
└── resources/META-INF/
└── plugin.xml
| IDE | Version |
|---|---|
| IntelliJ IDEA Community | 2025.0+ |
| IntelliJ IDEA Ultimate | 2025.0+ |
Requires the Java plugin to be enabled (for classpath resolution and go-to-definition).
Contributions welcome! See CONTRIBUTING.md for guidelines.
- 🐛 Report bugs
- 💡 Request features
- 🔧 Submit pull requests
MIT License — see LICENSE for details.
Keywords: Drools, DRL, IntelliJ IDEA plugin, Drools IDE, Drools editor, Drools syntax highlighting, Drools code completion, Drools validation, rule engine, business rules, JBoss Drools, KIE, .drl files, Drools IntelliJ, Drools JetBrains