0

我的 jbpm 应用程序有问题。它不解析 #{expression} 标签,按照 redhat 课程,它应该像它所说的那样:

名称中的#{requiredDocument} 语法在运行时替换为 requiredDocument 流程变量的值。这允许它显示不同的任务名称,具体取决于用户需要上传的文档。

这在我的情况下不起作用......但是在教程中,他使用业务中心来部署它的流程,而在我的情况下,我使用的是 spring 项目的结构是经典的 kjar-service:

-bpm-application
--bpm-application-service
--bpm-application-kjar

这是我的 kjar 项目的 pom

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>poc-decision-table-kjar</artifactId>
  <version>0.0.1</version>
  <packaging>kjar</packaging>
  <name>poc-decision-table-kjar</name>
  <properties>
    <maven.compiler.target>11</maven.compiler.target>
    <maven.compiler.source>11</maven.compiler.source>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.org.kie>7.54.0.Final</version.org.kie>
  </properties>
  <dependencies>
    <dependency>
      <groupId>it.poste</groupId>
      <artifactId>poc-decision-table-model</artifactId>
      <version>0.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.jbpm.contrib</groupId>
      <artifactId>jpa-workitem</artifactId>
      <version>7.54.0-SNAPSHOT</version>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-model-compiler</artifactId>
      <version>7.54.0.Final</version>
  </dependency>  
  </dependencies>
  <repositories>
    <repository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>https://repository.jboss.org/nexus/content/groups/public/</url>
    </repository>
  </repositories>
  <build>
    <plugins>
      <plugin>
        <groupId>org.kie</groupId>
        <artifactId>kie-maven-plugin</artifactId>
        <version>${version.org.kie}</version>
        <extensions>true</extensions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>docker</id>
      <activation>
        <property>
          <name>docker</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>additional-install</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <finalName>local</finalName>
                  <descriptors>
                    <descriptor>src/main/assembly/repository.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.4</version>
            <executions>
              <execution>
                <id>additional-install</id>
                <phase>install</phase>
                <goals>
                  <goal>install-file</goal>
                </goals>
                <configuration>
                  <file>${project.build.directory}/${project.build.finalName}.jar</file>
                  <pomFile>pom.xml</pomFile>
                  <localRepositoryPath>${project.build.directory}/local-repository/maven</localRepositoryPath>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>openshift</id>
      <activation>
        <property>
          <name>openshift</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>additional-install</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <finalName>local</finalName>
                  <descriptors>
                    <descriptor>src/main/assembly/repository.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.4</version>
            <executions>
              <execution>
                <id>additional-install</id>
                <phase>install</phase>
                <goals>
                  <goal>install-file</goal>
                </goals>
                <configuration>
                  <file>${project.build.directory}/${project.build.finalName}.jar</file>
                  <pomFile>pom.xml</pomFile>
                  <localRepositoryPath>${project.build.directory}/local-repository/maven</localRepositoryPath>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>

这是我的服务的 pom

4.0.0 com.example poc-decision-table-service 0.0.1 jar poc-decision-table-service

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.2.RELEASE</version>
</parent>

<properties>
    <version.org.kie>7.54.0.Final</version.org.kie>
    <maven.compiler.target>11</maven.compiler.target>
    <maven.compiler.source>11</maven.compiler.source>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <narayana.version>5.9.0.Final</narayana.version>
    <fabric8.version>3.5.40</fabric8.version>
</properties>

<dependencies>
    <dependency>
        <groupId>it.poste</groupId>
        <artifactId>poc-decision-table-model</artifactId>
        <version>0.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-server-spring-boot-starter</artifactId>
        <version>${version.org.kie}</version>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>

        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<profiles>

    <profile>
        <id>h2</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <dependencies>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
            </dependency>
        </dependencies>
    </profile>

    <profile>
        <id>mysql</id>
        <activation>
            <property>
                <name>mysql</name>
            </property>
        </activation>
        <dependencies>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </profile>

    <profile>
        <id>postgres</id>
        <activation>
            <property>
                <name>postgres</name>
            </property>
        </activation>
        <dependencies>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
            </dependency>
            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </profile>

    <profile>
        <id>docker</id>
        <activation>
            <property>
                <name>docker</name>
            </property>
        </activation>

        <build>
            <plugins>
                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>fabric8-maven-plugin</artifactId>
                    <version>${fabric8.version}</version>
                    <configuration>
                        <verbose>false</verbose>
                        <images>
                            <image>
                                <name>apps/${project.artifactId}:${project.version}</name>
                                <build>
                                    <from>fabric8/java-jboss-openjdk8-jdk</from>
                                    <assembly>
                                        <targetDir>/</targetDir>
                                        <inline>
                                            <files>
                                                <file>
                                                    <source>
                                                        ${project.build.directory}/${project.build.finalName}.${project.packaging}
                                                    </source>
                                                    <outputDirectory>deployments</outputDirectory>
                                                    <destName>${project.build.finalName}.${project.packaging}
                                                    </destName>
                                                </file>
                                                <file>
                                                    <source>${project.artifactId}.xml</source>
                                                    <outputDirectory>deployments</outputDirectory>
                                                    <destName>${project.artifactId}.xml</destName>
                                                </file>
                                            </files>
                                            <fileSet>
                                                <directory>src/main/docker</directory>
                                                <outputDirectory>opt/jboss/.m2</outputDirectory>
                                                <includes>
                                                    <include>settings.xml</include>
                                                </includes>
                                            </fileSet>
                                            <fileSet>
                                                <directory>
                                                    ../poc-decision-table-kjar/target/local-repository/maven
                                                </directory>
                                                <outputDirectory>opt/jboss/.m2/repository</outputDirectory>
                                            </fileSet>
                                        </inline>
                                        <user>jboss:jboss:jboss</user>
                                    </assembly>
                                </build>
                            </image>
                        </images>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>install</phase>
                            <goals>
                                <goal>resource</goal>
                                <goal>build</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>openshift</id>
        <activation>
            <property>
                <name>openshift</name>
            </property>
        </activation>

        <properties>
            <fabric8.mode>openshift</fabric8.mode>
            <fabric8.build.strategy>docker</fabric8.build.strategy>
        </properties>

        <build>
            <plugins>
                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>fabric8-maven-plugin</artifactId>
                    <version>${fabric8.version}</version>
                    <configuration>
                        <verbose>false</verbose>
                        <images>
                            <image>
                                <name>apps/${project.artifactId}:${project.version}</name>
                                <build>
                                    <from>fabric8/java-jboss-openjdk8-jdk</from>
                                    <assembly>
                                        <targetDir>/</targetDir>
                                        <inline>
                                            <files>
                                                <file>
                                                    <source>
                                                        ${project.build.directory}/${project.build.finalName}.${project.packaging}
                                                    </source>
                                                    <outputDirectory>deployments</outputDirectory>
                                                    <destName>${project.build.finalName}.${project.packaging}
                                                    </destName>
                                                </file>
                                                <file>
                                                    <source>${project.artifactId}.xml</source>
                                                    <outputDirectory>deployments</outputDirectory>
                                                    <destName>${project.artifactId}.xml</destName>
                                                </file>
                                            </files>
                                            <fileSet>
                                                <directory>src/main/docker</directory>
                                                <outputDirectory>opt/jboss/.m2</outputDirectory>
                                                <includes>
                                                    <include>settings.xml</include>
                                                </includes>
                                            </fileSet>
                                            <fileSet>
                                                <directory>
                                                    ../poc-decision-table-kjar/target/local-repository/maven
                                                </directory>
                                                <outputDirectory>opt/jboss/.m2/repository</outputDirectory>
                                            </fileSet>
                                        </inline>
                                        <user>jboss:jboss:jboss</user>
                                    </assembly>
                                    <ports>
                                        <port>8090</port>
                                    </ports>
                                </build>
                            </image>
                        </images>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>install</phase>
                            <goals>
                                <goal>resource</goal>
                                <goal>build</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

<repositories>
  <repository>
    <id>jboss-public-repository-group</id>
    <name>JBoss Public Repository Group</name>
    <url>https://repository.jboss.org/nexus/content/groups/public/</url>
    <layout>default</layout>
    <releases>
      <updatePolicy>never</updatePolicy>
    </releases>
    <snapshots>
      <updatePolicy>daily</updatePolicy>
    </snapshots>
  </repository>
</repositories>

这是我当前的任务,它具有进程在运行时未评估的#{expression}。事实上,当我启动进程时,它成功完成,但在嵌入式 h2 db 上,任务名称仍然是 EndTask-#{codiceEsito},而我更期待看到 EndTask-01(codiceEsito 是一个字符串 processVariable)

在此处输入图像描述

所以问题是,我是否缺少这种评估所需的一些依赖项?我被这件事困住了

编辑:这是从他们网站上的官方 redhat 课程中拍摄的图片,所以我想这是有可能的,他们让插入 #{} 表达式变得简单,在我的情况下它不起作用

在此处输入图像描述

编辑2:这是github上的项目(kjar)

4

0 回答 0