You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将Drools 7.1项目导入Drools Workbench UI?

Fix for Drools Workbench Not Recognizing DRL Files After Git Import

Hey there, let’s work through this problem— I’ve dealt with similar Workbench import quirks with existing Drools projects before, so here’s the most effective step-by-step solution set tailored to your 7.1 setup:

1. Ensure Your Project Follows Kie Module Standards

Workbench doesn’t just recognize any arbitrary project structure— it requires compliance with the Kie Module specification, even if your project runs fine with kSession.fireAllRules() locally. Here’s what to fix:

  • Add a kie-deployment-descriptor.xml file at your project root (this is the critical marker Workbench looks for). If you don’t have one, create a basic version:
    <?xml version="1.0" encoding="UTF-8"?>
    <kie-deployment-descriptor xmlns="http://jboss.org/kie/deployment-descriptor/v1.0">
        <runtime-strategy>SINGLETON</runtime-strategy>
        <release-id>
            <group-id>your.actual.group.id</group-id>
            <artifact-id>your.artifact.id</artifact-id>
            <version>your.project.version</version>
        </release-id>
    </kie-deployment-descriptor>
    
  • Move your DRL files to src/main/resources or a subdirectory like src/main/resources/rules (Workbench scans resource directories by default). If you need to keep a custom path, add this to the descriptor:
    <resources>
        <resource>
            <location>classpath:/your/custom/rules/directory</location>
            <type>DRL</type>
        </resource>
    </resources>
    
  • Update your pom.xml to include the Kie Maven plugin (Workbench relies on this to parse rule modules):
    <build>
        <plugins>
            <plugin>
                <groupId>org.kie</groupId>
                <artifactId>kie-maven-plugin</artifactId>
                <version>7.1.0.Final</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
    

2. Migrate Files Manually If Git Import Fails

If direct Git import still doesn’t pick up DRLs, bypass the auto-import by building a new Kie project in Workbench and migrating your code:

  • Create a new Kie Project in Workbench, matching your existing Group ID, Artifact ID, and version.
  • Navigate to the Repository view, upload your Java files to src/main/java (matching their original package structure).
  • Upload DRL files to src/main/resources or your configured custom directory.
  • Save all changes, then click Build at the top— Workbench will now index and recognize your rule files.

3. Fix Git Repository Issues

Sometimes the problem lies with your Git repo setup:

  • Ensure all DRL files have the lowercase .drl extension (Workbench may ignore uppercase variants).
  • Check for spaces or non-ASCII characters in file paths— replace them with underscores or hyphens.
  • Double-check that your DRL files aren’t listed in .gitignore (it’s easy to accidentally exclude them).
  • Confirm you’re importing the correct Git branch where all DRLs are committed.

4. Verify Version Compatibility

Since you’re using Drools 7.1, make sure your Workbench instance is also running 7.1.x. Version mismatches (e.g., using a newer Workbench with an older Kie project) can break file recognition and module parsing.

After making these changes, re-import your project or refresh the Workbench view— you should see your DRL files and folder structure appear, ready for DSL rule development.

内容的提问来源于stack exchange,提问作者PMD

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:29:13