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

在Drools Business Central Workbench中添加资产失败求助

解决KIE Business Central离线环境添加资产时的Maven依赖解析错误

首先,你遇到的org.default:artifact:jar:1.0.0确实是KIE在创建新项目时自动生成的默认占位符GAV,这个依赖本身并不存在于任何公共仓库,离线环境下KIE会尝试从配置的Nexus仓库拉取它,进而触发连接问题。结合报错里的Connection reset,咱们一步步排查解决:

1. 先解决Nexus的连接问题

连接重置通常是两种情况:容器无法访问Nexus服务,或者HTTPS证书不被信任(如果Nexus用了自签证书)。

  • 测试容器到Nexus的连通性:
    进入容器执行:

    docker exec -it <你的容器ID/名称> bash
    curl -v https://my.nexus.org/
    

    如果返回证书错误(比如SSL certificate problem: self signed certificate),需要把Nexus的CA证书导入容器的JVM信任库:

    1. 把Nexus的CA证书文件(比如nexus-ca.crt)复制到容器里:
      docker cp nexus-ca.crt <容器ID>:/opt/jboss/jdk/lib/security/
      
    2. 进入容器导入证书:
      keytool -importcert -file /opt/jboss/jdk/lib/security/nexus-ca.crt -alias nexus-ca -keystore /opt/jboss/jdk/lib/security/cacerts -storepass changeit -noprompt
      
    3. 重启容器让配置生效。
  • 检查Nexus仓库路径是否正确:
    确保settings.xml里的Nexus URL是完整的仓库路径(比如https://my.nexus.org/repository/maven-public/),而不是Nexus的首页地址。

2. 配置KIE适配离线环境

KIE默认会尝试远程仓库,离线环境下需要强制开启离线模式,同时指定自定义的Maven配置:

  • 修改Dockerfile添加离线启动参数:
    在Dockerfile末尾添加环境变量,覆盖默认的JAVA_OPTS:
    ENV JAVA_OPTS="-Dorg.kie.maven.settings.custom=/opt/jboss/.m2/settings.xml -Dmaven.repo.local=/opt/jboss/.m2/repository -Dkie.maven.offline=true"
    
    或者启动容器时直接传递参数:
    docker run -d -p 8080:8080 -e JAVA_OPTS="-Dorg.kie.maven.settings.custom=/opt/jboss/.m2/settings.xml -Dmaven.repo.local=/opt/jboss/.m2/repository -Dkie.maven.offline=true" <你的自定义镜像>
    

3. 完善Maven settings.xml配置

确保你的settings.xml不仅配置了镜像,还激活了指向Nexus的仓库和插件仓库,示例配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">
  <localRepository>/opt/jboss/.m2/repository</localRepository>
  
  <mirrors>
    <mirror>
      <id>nexus-central</id>
      <mirrorOf>central</mirrorOf>
      <url>https://my.nexus.org/repository/maven-public/</url>
    </mirror>
  </mirrors>

  <profiles>
    <profile>
      <id>nexus-repos</id>
      <repositories>
        <repository>
          <id>nexus</id>
          <url>https://my.nexus.org/repository/maven-public/</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>nexus-plugins</id>
          <url>https://my.nexus.org/repository/maven-public/</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>nexus-repos</activeProfile>
  </activeProfiles>
</settings>

4. 处理占位符依赖问题

既然org.default:artifact是KIE生成的占位符,你可以:

  • 创建项目时自定义GAV:在创建项目的第一步,就指定存在于你Nexus仓库的Group、Artifact、Version,避免使用默认的org.default:artifact。
  • 临时上传空POM到Nexus:如果需要保留默认GAV,可以手动创建一个空的pom.xml,内容如下,然后上传到Nexus的对应仓库:
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>org.default</groupId>
      <artifactId>artifact</artifactId>
      <version>1.0.0</version>
    </project>
    

5. 预构建项目依赖

进入容器后,找到KIE项目的存储目录(通常在/opt/jboss/business-central/data下),进入对应项目目录执行:

mvn clean install -s /opt/jboss/.m2/settings.xml -o

-o参数强制离线模式,会把项目依赖安装到本地Maven仓库,避免后续添加资产时重复触发远程拉取。

按以上步骤排查后,应该就能解决添加资产时的依赖解析错误了。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.04 17:30:42