camunda源代码编译运行(二):构建并运行camunda源代码工程

news2024/11/18 8:52:35

接上一篇文章:camunda源代码编译运行(一):下载编译camunda源代码

Camunda 7.19源代码一共有178个maven工程和1个angular前端工程,这么多工程中包括了大量的QA测试包、JDK不同版本适配(比如:Java EE和Jakarta EE)、多种中间件部署包(比如:Tomcat、Jboss、wildfly)、spring和springboot集成适配包等,我们仅仅需要把Camunda的流程引擎包和REST服务包的源代码拿来使用,下面通过IDEA开发工具,从代码层面整合Camunda的流程引擎源代码。

3.1、Camunda包结构分析

Camunda 7.19源代码一共有178个maven工程和1个angular前端工程,他们之间有什么样的依赖和引用关系,我们首先要分析清楚,然后才能把流程引擎和resf服务包的源代码拷贝过来使用。

下面我们就分析camunda-bpm-platform-7.19.0源代码中pom工程的引用和依赖关系。

首先,打开camunda-bpm-platform-7.19.0\engine工程的pom.xml,发现该工程继承了父工程camunda-database-settings。

打开父工程camunda-bpm-platform-7.19.0\database的pom.xml,发现它又继承了父工程camunda-parent。

打开父工程camunda-bpm-platform-7.19.0\parent的pom.xml,发现它又继承了父工程camunda-root。

打开父工程camunda-bpm-platform-7.19.0根目录下的pom.xml,发现它又继承了父工程camunda-bpm-release-parent,该工程没有源代码,就是camunda官方定义的发布版本的顶级工程了,是通过mvn依赖动态下载的。

至此,我们从camunda流程引擎内核包入手分析,找到了相关maven工程父子继承关系,即engine(BPMN流程引擎核心工程)—》database(多种数据库配置工程)—》parent(第三方Jar配置工程)—》root(camunda源代码聚合工程)。

有了以上分析,下面我们在自己的笔记本电脑上新建Java工程,把camunda核心源代码拷贝进来编译通过,最后通过springboot方式,把camunda源代码运行起来。

3.2、新建maven聚合工程

新建pom父工程,命名为camunda7-source-dev,version设置为7.19-SNAPSHOT,注意packaging的值为pom,该工程为聚合项目。

该工程的目的就是多个maven工程聚合,也可以根据需要配置一些manve的全局设置,比如仓库地址。

Pom.xml源文件如下:

<?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>com.yuncheng</groupId>
    <artifactId>camunda7-source-dev</artifactId>
    <version>7.19-SNAPSHOT</version>
    <packaging>pom</packaging>
    <modules>
<!--        <module>camunda-engine</module>-->
<!--        <module>camunda-engine-rest</module>-->
<!--        <module>camunda-boot</module>-->
    </modules>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

</project>

3.3、新建maven父工程

通过以上分析camunda工程结构,发现camunda-engine流程引擎依赖了camunda-parent工程,而camunda-parent工程里定义了流程引擎需要的第三方Jar。这里我们也参考camunda-parent工程,新建一个自己的parent工程。

在刚才建的聚合工程camunda7-source-dev下,新建一个camunda-parent子工程。

我们需要把camunda-bpm-platform-7.19.0\parent\pom.xml文件内容拷贝过来,最后的pom.xml源文件如下:

<?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>
    <parent>
        <groupId>com.yuncheng</groupId>
        <artifactId>camunda7-source-dev</artifactId>
        <version>7.19-SNAPSHOT</version>
    </parent>
    <packaging>pom</packaging>

    <artifactId>camunda-parent</artifactId>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <license.includeTransitiveDependencies>false</license.includeTransitiveDependencies>
        <!-- These properties are used in both the BOM as well as camunda-parent and subprojects -->
        <version.camunda>7.19.0</version.camunda>
        <version.mybatis>3.5.6</version.mybatis>
        <version.joda-time>2.1</version.joda-time>
        <version.uuid-generator>3.2.0</version.uuid-generator>
        <version.camunda.commons>1.12.0</version.camunda.commons>
        <version.camunda.connect>1.5.6</version.camunda.connect>
        <version.camunda.spin>1.19.0</version.camunda.spin>
        <version.camunda.template-engines>2.1.0</version.camunda.template-engines>
        <version.camunda.ee.xslt-plugin>1.1.0</version.camunda.ee.xslt-plugin>
        <version.feel-scala>1.15.3</version.feel-scala>
        <plugin.version.javadoc>3.0.1</plugin.version.javadoc>

        <!-- database driver versions -->
        <version.h2>2.1.214</version.h2>
        <version.h2-v1>1.4.190</version.h2-v1><!-- used for instance migration qa -->
        <version.oracle-12>12.1.0.2</version.oracle-12>
        <version.oracle-19>19.3.0.0</version.oracle-19>
        <version.oracle>${version.oracle-12}</version.oracle>
        <version.mariadb>1.7.6</version.mariadb>
        <version.mariadb-v1>1.1.8</version.mariadb-v1>
        <version.mysql>8.0.32</version.mysql>
        <version.sqlserver>8.4.1.jre8</version.sqlserver>
        <version.db2-11.5>11.5.0.0</version.db2-11.5>
        <version.db2>${version.db2-11.5}</version.db2>
        <version.postgresql>42.5.4</version.postgresql>
        <version.liquibase>4.8.0</version.liquibase>

        <!-- CockroachDB is compatible with PostgreSQL 9.5,
        so a different version of the JDBC driver needs to be used -->
        <version.cockroachdb>42.2.9</version.cockroachdb>

        <!-- needed for sql script and backward compatibility checks -->
        <camunda.version.old>7.18.0</camunda.version.old>

        <!-- Testcontainers JDBC URL parameters. By default, an empty string -->
        <database.tc.params />


        <version.quarkus>2.16.4.Final</version.quarkus>
        <version.spring.framework>5.3.22</version.spring.framework>
        <version.spring-boot>2.7.9</version.spring-boot>
        <version.cxf>3.0.3</version.cxf>
        <version.resteasy>3.15.3.Final</version.resteasy>
        <version.jersey2>2.34</version.jersey2>
        <!-- use minimum version of resteasy and jersey -->
        <version.jaxrs.api>2.0.1.Final</version.jaxrs.api>
        <version.groovy>2.4.21</version.groovy>
        <version.graal.js>21.1.0</version.graal.js>
        <version.icu.icu4j>68.2</version.icu.icu4j>
        <version.gson>2.8.9</version.gson>
        <version.openjpa>2.4.3</version.openjpa>
        <version.hibernate>5.6.5.Final</version.hibernate>
        <version.hikaricp>4.0.3</version.hikaricp>
        <version.jackson>2.14.1</version.jackson>
        <version.xml.bind-api>2.3.3</version.xml.bind-api>
        <version.xml.jaxb-impl>2.3.6</version.xml.jaxb-impl>
        <version.snakeyaml>1.33</version.snakeyaml>

        <version.slf4j>1.7.26</version.slf4j>
        <version.logback>1.2.11</version.logback>
        <version.junit>4.13.1</version.junit>
        <version.assertj>2.9.1</version.assertj>
        <version.mockito>4.3.1</version.mockito>
        <version.wiremock>2.27.2</version.wiremock>
        <version.wiremock-jre8>2.27.2</version.wiremock-jre8>
        <version.testcontainers>1.16.0</version.testcontainers>

        <version.commonj>1.1.0</version.commonj>
        <version.bouncycastle>1.47</version.bouncycastle>

        <!-- application servers -->
        <version.wildfly>27.0.1.Final</version.wildfly>
        <version.wildfly.core>19.0.1.Final</version.wildfly.core>
        <version.wildfly26>26.0.1.Final</version.wildfly26>
        <version.wildfly26.core>18.0.4.Final</version.wildfly26.core>

        <version.tomcat>9.0.72</version.tomcat>

        <version.arquillian>1.1.10.Final</version.arquillian>
        <version.shrinkwrap.resolvers>2.2.2</version.shrinkwrap.resolvers>
        <version.selenium>4.1.4</version.selenium>
        <version.freemarker>2.3.31</version.freemarker>

        <version.jboss-javaee-spec>3.0.2.Final</version.jboss-javaee-spec>
        <version.jakarta-ee-spec>10.0.0</version.jakarta-ee-spec>
    </properties>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>com.h2database</groupId>
                <artifactId>h2</artifactId>
                <version>${version.h2}</version>
            </dependency>
            <dependency>
                <groupId>com.oracle.jdbc</groupId>
                <artifactId>ojdbc7</artifactId>
                <version>${version.oracle}</version>
            </dependency>
            <dependency>
                <groupId>com.oracle.ojdbc</groupId>
                <artifactId>ojdbc8</artifactId>
                <version>${version.oracle}</version>
            </dependency>
            <dependency>
                <groupId>org.mariadb.jdbc</groupId>
                <artifactId>mariadb-java-client</artifactId>
                <version>${version.mariadb}</version>
            </dependency>
            <dependency>
                <groupId>com.mysql</groupId>
                <artifactId>mysql-connector-j</artifactId>
                <version>${version.mysql}</version>
            </dependency>
            <dependency>
                <groupId>com.microsoft.sqlserver</groupId>
                <artifactId>mssql-jdbc</artifactId>
                <version>${version.sqlserver}</version>
            </dependency>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>${version.postgresql}</version>
            </dependency>
            <dependency>
                <groupId>com.ibm.db2</groupId>
                <artifactId>jcc</artifactId>
                <version>${version.db2}</version>
            </dependency>

            <dependency>
                <groupId>org.camunda.bpm</groupId>
                <artifactId>camunda-bom</artifactId>
                <version>${version.camunda}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <!-- test plugins -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.2</version>
                    <configuration>
                        <runOrder>hourly</runOrder>
                        <systemPropertyVariables>
                            <myWorkingDir>${project.build.directory}</myWorkingDir>
                        </systemPropertyVariables>
                        <argLine>-Xmx968m -Duser.language=en -Duser.region=US -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${project.build.directory}/heap_dump.hprof</argLine>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.16</version>
                    <configuration>
                        <argLine>-Xmx968m</argLine>
                        <runOrder>hourly</runOrder>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- code plugins -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.8</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                </plugin>

                <!-- artifact plugins -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <configuration>
                        <createSourcesJar>true</createSourcesJar>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.8</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.9.1</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven3-plugin</artifactId>
                    <version>1.10.5</version>
                </plugin>
                <plugin>
                    <groupId>net.kennychua</groupId>
                    <artifactId>maven-urlpoller-plugin</artifactId>
                    <version>1.0.3</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>sql-maven-plugin</artifactId>
                    <version>1.5</version>
                    <configuration>
                        <keepFormat>true</keepFormat>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>clirr-maven-plugin</artifactId>
                    <version>2.8</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>1.4.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>3.3.2</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <failOnError>false</failOnError>
                        <additionalJOptions>
                            <additionalJOption>-Xdoclint:none</additionalJOption>
                            <additionalJOption>--ignore-source-errors</additionalJOption>
                        </additionalJOptions>
                        <doctitle>Camunda Platform Javadocs ${project.version}</doctitle>
                        <windowtitle>Camunda Platform Javadocs ${project.version}</windowtitle>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <profiles>

    </profiles>

    <repositories>
        <repository>
            <id>JBoss public</id>
            <name>jboss</name>
            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
        <!-- required for commonJ dependency -->
        <repository>
            <id>com.springsource.repository.bundles.external</id>
            <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
            <url>https://repo.spring.io/plugins-release</url>
        </repository>
    </repositories>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <organization>
        <name>camunda services GmbH</name>
        <url>http://www.camunda.com</url>
    </organization>

    <url>http://www.camunda.org</url>
</project>

3.4、新建流程引擎源码工程

在聚合工程camunda7-source-dev下,新建一个camunda-engine流程引擎子工程,需要把该工程的父工程配置为camunda-parent

我们需要把camunda-bpm-platform-7.19.0\engine\pom.xml文件内容拷贝过来,最后的pom.xml源文件如下:

<?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>
    <parent>
        <groupId>com.yuncheng</groupId>
        <artifactId>camunda-parent</artifactId>
        <version>7.19-SNAPSHOT</version>
        <relativePath>../camunda-parent</relativePath>
    </parent>

    <artifactId>camunda-engine</artifactId>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <test.includes />
        <!-- without a special test profile we don't want to exclude anything, this expressions should never match -->
        <test.excludes>$.</test.excludes>
        <history.level>full</history.level>
        <mail.server.port>5025</mail.server.port>
        <authorizationCheckRevokes>auto</authorizationCheckRevokes>
        <jdbcBatchProcessing>true</jdbcBatchProcessing>

        <!-- We shade artifacts into the jar, so we need to generate a dependency BOM
        for the license book -->
        <skip-third-party-bom>false</skip-third-party-bom>

        <camunda.artifact>org.camunda.bpm</camunda.artifact>
        <version.camunda>7.19.0</version.camunda>
    </properties>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>org.camunda.bpm</groupId>
                <artifactId>camunda-core-internal-dependencies</artifactId>
                <version>${version.camunda}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-framework-bom</artifactId>
                <version>${version.spring.framework}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>jakarta.platform</groupId>
                <artifactId>jakarta.jakartaee-bom</artifactId>
                <version>${version.jakarta-ee-spec}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <dependencies>

        <!-- camunda dependencies -->

        <dependency>
            <groupId>org.camunda.bpm.model</groupId>
            <artifactId>camunda-bpmn-model</artifactId>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm.model</groupId>
            <artifactId>camunda-cmmn-model</artifactId>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm.dmn</groupId>
            <artifactId>camunda-engine-dmn</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>de.odysseus.juel</groupId>
                    <artifactId>juel-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.odysseus.juel</groupId>
                    <artifactId>juel-spi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>de.odysseus.juel</groupId>
                    <artifactId>juel-impl</artifactId>
                </exclusion>
                <!-- these exclusions are needed when building with Maven >= 3.3
                  see CAM-11822 for details -->
                <exclusion>
                    <groupId>com.lihaoyi</groupId>
                    <artifactId>fastparse_2.13</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.lihaoyi</groupId>
                    <artifactId>sourcecode_2.13</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.lihaoyi</groupId>
                    <artifactId>geny_2.13</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.scala-lang</groupId>
                    <artifactId>scala-library</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.camunda.commons</groupId>
            <artifactId>camunda-commons-logging</artifactId>
        </dependency>

        <dependency>
            <groupId>org.camunda.commons</groupId>
            <artifactId>camunda-commons-typed-values</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </dependency>

        <dependency>
            <groupId>joda-time</groupId>
            <artifactId>joda-time</artifactId>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>

        <dependency>
            <groupId>org.camunda.connect</groupId>
            <artifactId>camunda-connect-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.camunda.connect</groupId>
            <artifactId>camunda-connect-connectors-all</artifactId>
            <scope>runtime</scope>
        </dependency>

        <!-- provided dependencies -->

        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jta_1.1_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.uuid</groupId>
            <artifactId>java-uuid-generator</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-web-6.0</artifactId>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.transaction</groupId>
            <artifactId>jakarta.transaction-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>jakarta.ejb</groupId>
            <artifactId>jakarta.ejb-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>catalina</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.jboss</groupId>
            <artifactId>jboss-vfs</artifactId>
            <version>3.1.0.Final</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-email</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- test dependencies  -->

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.subethamail</groupId>
            <artifactId>subethasmtp-wiser</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <!-- required for DiagramQueryTest -->
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.camunda.commons</groupId>
            <artifactId>camunda-commons-testing</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm</groupId>
            <artifactId>camunda-test-utils-testcontainers</artifactId>
            <version>${version.camunda}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.github.tomakehurst</groupId>
            <artifactId>wiremock</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-jsr223</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.python</groupId>
            <artifactId>jython</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jruby</groupId>
            <artifactId>jruby-complete</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.graalvm.js</groupId>
            <artifactId>js-scriptengine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm</groupId>
            <artifactId>camunda-bpm-archunit</artifactId>
            <version>${version.camunda}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>


    <build>
        <!-- filter test configurations to inject properties -->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>org/camunda/bpm/engine/product-info.properties</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/camunda.cfg.xml</include>
                    <include>**/*camunda.cfg.xml</include>
                    <include>**/camunda.cfg.*.xml</include>
                    <include>testconfig.properties</include>
                    <include>**/testcontainers.properties</include>
                </includes>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <failIfNoTests>false</failIfNoTests>
                    <trimStackTrace>false</trimStackTrace>
                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
                    <includes>
                        <include>%regex[.*(${test.includes}).*Test.*.class]</include>
                    </includes>
                    <excludes>
                        <exclude>**/*TestCase.java</exclude>
                        <exclude>%regex[.*(${test.excludes}).*Test.*.class]</exclude>
                    </excludes>
                    <dependenciesToScan>
                        <dependency>org.camunda.bpm:camunda-bpm-archunit</dependency>
                    </dependenciesToScan>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>cleanVersions</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>bundle-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>manifest</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <configuration>
                    <promoteTransitiveDependencies>false</promoteTransitiveDependencies>
                    <createSourcesJar>true</createSourcesJar>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                    <keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
                    <artifactSet>
                        <excludes>
                            <exclude>org.camunda.bpm.model:*</exclude>
                            <exclude>org.camunda.bpm.dmn:*</exclude>
                            <exclude>org.camunda.commons:*</exclude>
                            <exclude>org.camunda.connect:*</exclude>
                            <exclude>org.camunda.feel:*</exclude>

                            <exclude>org.springframework:*</exclude>
                            <exclude>org.slf4j:*</exclude>
                            <exclude>org.apache.commons:*</exclude>
                            <exclude>com.sun.mail:*</exclude>
                            <exclude>javax.activation:*</exclude>
                            <exclude>org.mybatis:mybatis:*</exclude>
                            <exclude>commons-logging:*</exclude>
                            <exclude>joda-time:*</exclude>
                        </excludes>
                    </artifactSet>
                    <relocations>
                        <relocation>
                            <pattern>com.google.gson</pattern>
                            <shadedPattern>camundajar.impl.com.google.gson</shadedPattern>
                        </relocation>
                    </relocations>
                    <transformers>
                        <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                    </transformers>
                    <shadeTestJar>true</shadeTestJar>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-upgrade-scripts-liquibase</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>

                                <!-- copy all upgrade scripts after 7.15 -->
                                <mkdir dir="target/classes/org/camunda/bpm/engine/db/liquibase/upgrade" />
                                <copy todir="target/classes/org/camunda/bpm/engine/db/liquibase/upgrade">
                                    <fileset dir="target/classes/org/camunda/bpm/engine/db/upgrade" excludes="*_6.*_*,*_7.0_*,*_7.1_*,*_7.2_*,*_7.3_*,*_7.4_*,*_7.5_*,*_7.6_*,*_7.7_*, *_7.8_*,*_7.9_*,*_7.10_*,*_7.11_*,*_7.12_*,*_7.13_*,*_7.14_*,*_7.15_*" />
                                </copy>

                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.felix</groupId>
                                        <artifactId>
                                            maven-bundle-plugin
                                        </artifactId>
                                        <versionRange>
                                            [2.1.0,)
                                        </versionRange>
                                        <goals>
                                            <goal>cleanVersions</goal>
                                            <goal>manifest</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>distro</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>h2-in-memory</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <database.url>jdbc:h2:mem:camunda;DB_CLOSE_DELAY=1000;LOCK_TIMEOUT=10000</database.url>
                <database.driver>org.h2.Driver</database.driver>
                <database.username>sa</database.username>
                <database.password />
                <hibernate.dialect>org.hibernate.dialect.H2Dialect</hibernate.dialect>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.h2database</groupId>
                    <artifactId>h2</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>sql-maven-plugin</artifactId>
                            <dependencies>
                                <dependency>
                                    <groupId>com.h2database</groupId>
                                    <artifactId>h2</artifactId>
                                    <version>${version.h2}</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

    </profiles>

</project>

到这里,你可以通过IDEA的maven工具先执行mvn clean install命令,把相关依赖包下载下来,同时验证一下这几个maven工程是否能编译通过。

接下来,拷贝camunda-bpm-platform-7.19.0\engine引擎包下的源代码到自己刚刚新建的camunda-engine工程下,再执行mvn clean install命令进行编译打包,检查是否可以通过。由于camunda-engine源代码中有大量的测试用例,编译比较耗时,这里通过mvn clean install -DskipTests=true命令跳过测试用例执行。

3.5、新建REST服务源码工程

在聚合工程camunda7-source-dev下,新建一个camunda-engine-rest流程引擎rest服务子工程,需要把该工程的父工程配置为camunda-parent

我们需要把camunda-bpm-platform-7.19.0\engine-rest\engine-rest\pom.xml文件内容拷贝过来,最后的pom.xml源文件如下:

<?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>
    <parent>
        <groupId>com.yuncheng</groupId>
        <artifactId>camunda-parent</artifactId>
        <version>7.19-SNAPSHOT</version>
        <relativePath>../camunda-parent</relativePath>
    </parent>

    <artifactId>camunda-engine-rest</artifactId>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <version.rest-assured>4.5.0</version.rest-assured>
        <!-- override groovy version with the one used by rest-assured -->
        <version.groovy>3.0.9</version.groovy>
        <version.apache.httpcore>4.4.5</version.apache.httpcore>
        <version.commons-codec>1.15</version.commons-codec>
        <!-- pin tomcat version for engine-rest -->
        <version.tomcat>7.0.50</version.tomcat>
        <rest.http.port>38080</rest.http.port>
        <javax.activation.version>1.1.1</javax.activation.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <!-- Import dependency management from Spring Boot -->
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${version.spring-boot}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-bom</artifactId>
                <version>${version.groovy}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>org.camunda.bpm</groupId>
                <artifactId>camunda-core-internal-dependencies</artifactId>
                <version>${version.camunda}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.bind</groupId>
                <artifactId>jaxb-impl</artifactId>
                <version>${version.xml.jaxb-impl}</version>
            </dependency>
            <dependency>
                <groupId>io.rest-assured</groupId>
                <artifactId>rest-assured</artifactId>
                <version>${version.rest-assured}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${version.jackson}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpcore</artifactId>
                <version>${version.apache.httpcore}</version>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>${version.commons-codec}</version>
            </dependency>
        </dependencies>

    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>commons-io</groupId>
                    <artifactId>commons-io</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- override managed version from commons-fileupload -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-json-provider</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>jakarta.activation</groupId>
                    <artifactId>jakarta.activation-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jakarta.xml.bind</groupId>
                    <artifactId>jakarta.xml.bind-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>

        <!-- provided deps -->
        <dependency>
            <groupId>org.jboss.spec.javax.servlet</groupId>
            <artifactId>jboss-servlet-api_3.0_spec</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.yuncheng</groupId>
            <artifactId>camunda-engine</artifactId>
            <version>7.19-SNAPSHOT</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-jcl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.camunda.commons</groupId>
            <artifactId>camunda-commons-logging</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>${javax.activation.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <version>${version.tomcat}</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${version.spring.framework}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-jcl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Tomcat for resteasy and wink -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.camunda.commons</groupId>
            <artifactId>camunda-commons-testing</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-core</artifactId>
            <version>${version.tomcat}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-logging-juli</artifactId>
            <version>${version.tomcat}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <restEasyVersion>${version.resteasy}</restEasyVersion>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <id>distro</id>
            <dependencies>
                <dependency>
                    <groupId>org.jboss.spec.javax.ws.rs</groupId>
                    <artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
                    <scope>provided</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>jersey2</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>javax.ws.rs-api</artifactId>
                    <version>2.0.1</version>
                    <scope>provided</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.jersey.containers</groupId>
                    <artifactId>jersey-container-grizzly2-http</artifactId>
                    <version>${version.jersey2}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.jersey.containers</groupId>
                    <artifactId>jersey-container-servlet</artifactId>
                    <version>${version.jersey2}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.jersey.inject</groupId>
                    <artifactId>jersey-hk2</artifactId>
                    <version>${version.jersey2}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>**/rest/standalone/**</exclude>
                            </excludes>
                            <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        </configuration>
                        <executions>
                            <execution>
                                <id>encoding-test</id>
                                <phase>test</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <argLine>-Dfile.encoding=ISO-8859-1</argLine>
                                    <includes>
                                        <include>**/ProcessDefinitionRestServiceInteractionTest.java</include>
                                        <include>**/TaskRestServiceInteractionTest.java</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-test-source</id>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>add-test-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/test/java-jersey2</source>
                                    </sources>
                                </configuration>
                            </execution>
                            <execution>
                                <id>add-test-resource</id>
                                <phase>generate-test-resources</phase>
                                <goals>
                                    <goal>add-test-resource</goal>
                                </goals>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>src/test/resources-jersey2</directory>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>
</project>

接下来,拷贝camunda-bpm-platform-7.19.0\engine-rest\engine-rest工程下的源代码到自己刚刚新建的工程里,再执行mvn clean install命令进行编译打包,检查是否可以通过。

3.6、新建Springboot启动工程

以上4个步骤新建了4个Java maven工程,如果这4个工程均可编译通过,说明camunda源代码迁移这一步骤是没有问题的,接下来就是需要把camunda流程引擎基于源代码方式运行起来。

在聚合工程camunda7-source-dev下,新建一个名称为camunda-boot 的工程,即流程引擎的springboot启动工程。

在该工程下把需要把刚刚新建的流程引擎工程camunda-engine和流程引擎服务工程camunda-engine-rest引入进来,确保它是基于源代码运行的,最后的pom.xml源文件如下:

<?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>
    <parent>
        <groupId>com.yuncheng</groupId>
        <artifactId>camunda-parent</artifactId>
        <version>7.19-SNAPSHOT</version>
        <relativePath>../camunda-parent</relativePath>
    </parent>

    <artifactId>camunda-boot</artifactId>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!--定义使用camunda的版本-->
        <version.camunda>7.19.0</version.camunda>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <!-- Import dependency management from Spring Boot -->
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${version.spring-boot}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.2.15</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>

        <dependency>
            <groupId>com.yuncheng</groupId>
            <artifactId>camunda-engine</artifactId>
            <version>7.19-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>com.yuncheng</groupId>
            <artifactId>camunda-engine-rest</artifactId>
            <version>7.19-SNAPSHOT</version>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm.springboot</groupId>
            <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
            <version>${version.camunda}</version>
            <!--排除官方引用jar包,用自己工程里的源代码包-->
            <exclusions>
                <exclusion>
                    <groupId>org.camunda.bpm</groupId>
                    <artifactId>camunda-engine</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.camunda.bpm</groupId>
                    <artifactId>camunda-engine-rest-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.camunda.bpm.springboot</groupId>
            <artifactId>camunda-bpm-spring-boot-starter</artifactId>
            <version>${version.camunda}</version>
            <!--排除官方引用jar包,用自己工程里的源代码包-->
            <exclusions>
                <exclusion>
                    <groupId>org.camunda.bpm</groupId>
                    <artifactId>camunda-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

    </dependencies>

</project>

接下来,新建一个SpringBootApplication启动类:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

@SpringBootApplication
public class Camunda7Application {

    private static final Logger log = LoggerFactory.getLogger(Camunda7Application.class);

    public static void main(String[] args) {
        ConfigurableApplicationContext application = SpringApplication.run(Camunda7Application.class, args);
        Environment env = application.getEnvironment();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        if (path == null || "".equals(path)) {
            path = "/";
        }
        log.info("\n----------------------------------------------------------\n" +
                "\tApplication is running!\n" +
                "\tPort:\t" + port + "\n" +
                "\tPath:\t" + path + "\n" +
                "----------------------------------------------------------");
    }
}

最后,新建一个springboot启动的application.yaml配置文件,我这里用的是druid连接池,H2数据库,你也可以根据需要切换成mysql数据库

server:
  port: 8080
spring:
  datasource:
    druid:
      stat-view-servlet:
        enabled: true
        allow:
      web-stat-filter:
        enabled: true
    dynamic:
      druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
        # 连接池的配置信息
        # 初始化大小,最小,最大
        initial-size: 5
        min-idle: 5
        maxActive: 20
        # 配置获取连接等待超时的时间
        maxWait: 60000
        # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
        timeBetweenEvictionRunsMillis: 60000
        # 配置一个连接在池中最小生存的时间,单位是毫秒
        minEvictableIdleTimeMillis: 300000
        validationQuery: SELECT 1 FROM DUAL
        testWhileIdle: true
        testOnBorrow: false
        testOnReturn: false
        # 打开PSCache,并且指定每个连接上PSCache的大小
        poolPreparedStatements: true
        maxPoolPreparedStatementPerConnectionSize: 20
        # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
        filters: stat,slf4j
        # 通过connectProperties属性来打开mergeSql功能;慢SQL记录
        connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
        wall:
          comment-allow: true
      datasource:
        master:
          url: jdbc:h2:mem:camunda;DB_CLOSE_DELAY=1000;LOCK_TIMEOUT=10000
          username: sa
          password:
          driver-class-name: org.h2.Driver
camunda:
  bpm:
    database:
      type: h2
      schema-update: true
    auto-deployment-enabled: false # 自动部署 resources 下的 bpmn文件
    admin-user:
      id: demo
      password: demo

以上这些完成后,启动springboot工程即可。

至此,我们完成了基于camunda源代码编译和运行流程引擎。

接下来通过rest服务接口验证camunda流程引擎的功能。

camunda源代码编译运行(三):验证camunda API接口功能

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1462389.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Vue3之ref与reactive的基本使用

ref可以创建基本类型、对象类型的响应式数据 reactive只可以创建对象类型的响应式数据 接下来让我为大家介绍一下吧&#xff01; 在Vue3中&#xff0c;我们想让数据变成响应式数据&#xff0c;我们需要借助到ref与reactive 先为大家介绍一下ref如何使用还有什么注意点 我们需…

【快速搞定Webpack5】处理样式资源(三)

本次内容我们将学习使用webpack如何处理css、less、sass、scss等样式资源 介绍 webpack本身是不能识别样式资源的&#xff0c;所以我们需要借助loader包来帮助webpack解析样式资源 我们找loader都应该去官方文档中查找对应的loader&#xff0c;然后学习使用。 官方文档找不到…

windows server设置桌面显示此电脑

我开发的chatgpt网站&#xff1a; https://chat.xutongbao.top

Sora - 探索AI视频模型的无限可能-官方报告解读与思考

一、引言 最近SORA火爆刷屏&#xff0c;我也忍不住找来官方报告分析了一下&#xff0c;本文将深入探讨OpenAI最新发布的Sora模型。Sora模型不仅仅是一个视频生成器&#xff0c;它代表了一种全新的数据驱动物理引擎&#xff0c;能够在虚拟世界中模拟现实世界的复杂现象。本文将重…

内网穿透——NPS突然无法连接

温馨提示 &#x1f60a;&#x1f60a;&#x1f60a;&#x1f60a;&#x1f60a;&#x1f60a;&#x1f60a;&#x1f32d;&#x1f32d;&#x1f32d;&#x1f32d;&#x1f32d;&#x1f32d;&#x1f32d;❤️❤️❤️❤️❤️❤️❤️&#x1f968;&#x1f968;&#x1f9…

JavaSprintBoot中一些运维方面的知识

1.配置文件四级分类 例如以下yml配置文件&#xff0c;权限一共有四级&#xff0c;高等级覆盖低等级并叠加&#xff08;权限向下兼容&#xff09; 2.自定义配置文件 可以自定义配置文件的名称&#xff0c;因为实际开发环境中可能不会就简单的叫做application.yml之类的&#x…

《穿越科技的前沿:计算机专业必看的电影盛宴》

文章目录 每日一句正能量前言电影推荐推荐一&#xff1a;《黑客帝国》推荐二&#xff1a;《社交网络》推荐三&#xff1a;《源代码》推荐四&#xff1a;《谍影重重》系列推荐五&#xff1a;《旋转木马》 技术与主题后记 每日一句正能量 一个人的一生&#xff0c;就是一座有了年…

【Linux】MySQL数据库的使用

【Linux】MySQL数据库的使用 一、访问MySQL数据库二、创建及删除库和表1、创建新的库2、创建新的表3、删除一个数据表4、删除一个数据库 三、管理表中的数据记录1、插入数据记录2、查询数据记录3、修改数据记录4、删除数据记录 四、数据库用户授权1、授予权限2、查看权限3、撤销…

每日OJ题_二叉树dfs④_力扣98. 验证二叉搜索树

目录 力扣98. 验证二叉搜索树 解析代码 力扣98. 验证二叉搜索树 98. 验证二叉搜索树 难度 中等 给你一个二叉树的根节点 root &#xff0c;判断其是否是一个有效的二叉搜索树。 有效 二叉搜索树定义如下&#xff1a; 节点的左子树只包含 小于 当前节点的数。节点的右子树…

仿12306校招项目-项目业务和架构

目录 业务图 用户管理 业务难点 1. 如何确定用户注册信息的真实性 2. 面对亿级用户量 3. 支持多种登录方式会造成读请求扩散&#xff0c;需要解决用户定位问题 4. 高并发场景下缓存穿透问题需要有效解决&#xff0c;避免数据库压力过大 5. 明文存储用户敏感信息会造成安…

深度学习基础——SSD目标检测

SSD网络介绍 使用多个特征图作为特征预测层。 SSD (Single Shot MultiBox Detector)于2016年提出。当网络输入为300300大小时&#xff0c;在VOC2007测试集上达到74.3%的mAP;当输入是512512大小时&#xff0c;达到了76.9%的mAP SSD_Backbone部分介绍 不变的部分 特征提取网…

H5移动端文件预览pdf

H5移动端文件预览pdf 需求&#xff1a;H5页面嵌入浙政钉&#xff0c;需要文件预览Pdf。 试用了多个插件&#xff0c;踩了很多坑&#xff0c;如果小伙伴有类似填坑经历&#xff0c;并成功解决&#xff0c;感谢留言指点&#xff01;&#xff01;&#xff01; 先讲最终方案&#x…

C++从入门到精通 第十三章(认识STL)

写在前面&#xff1a; 本系列专栏主要介绍C的相关知识&#xff0c;思路以下面的参考链接教程为主&#xff0c;大部分笔记也出自该教程&#xff0c;笔者的原创部分主要在示例代码的注释部分。除了参考下面的链接教程以外&#xff0c;笔者还参考了其它的一些C教材&#xff08;比…

做过的卷子如何转换成空白卷子?3种还原方法分享

做过的卷子如何转换成空白卷子&#xff1f;在日常学习中&#xff0c;将做过的卷子转换成空白卷子具有极大的实用性。通过使用扫描工具&#xff0c;可以迅速将已完成的卷子恢复成空白状态&#xff0c;为后续的复习或练习提供便利。这种转换不仅省去了重新寻找或制作新卷子的麻烦…

Javascript中var和let之间的区别

文章目录 一.变量提升(声)二.let和var的区别 区别&#xff1a; 1、var有变量提升&#xff0c;而let没有&#xff1b; 2、let不允许在相同的作用域下重复声明&#xff0c;而var允许&#xff1b; 3、let没有暂时性死区问题&#xff1b; 4、let创建的全局变量没有给window设置对应…

腾讯云宝塔Linux安装Mysql5.7

一、下载官方mysql包 wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm二、安装mysql包 rpm -ivh mysql-community-release-el7-5.noarch.rpm三、安装mysql yum install mysql-community-server -y四、启动数据库 systemctl start mysqld.service…

2023 re:Invent 用 PartyRock 10 分钟构建你的 AI 应用

前言 一年一度的亚马逊云科技的 re:Invent 可谓是全球云计算、科技圈的狂欢&#xff0c;每次都能带来一些最前沿的方向标&#xff0c;这次也不例外。在看完一些 keynote 和介绍之后&#xff0c;我也去亲自体验了一些最近发布的内容。其中让我感受最深刻的无疑是 PartyRock 了。…

无人机的视频图传技术

在操控无人机时&#xff0c;视频图传技术显得尤为关键。通过这项技术&#xff0c;无人机的摄像头所捕捉的画面能实时回传至遥控器&#xff0c;使操作者全面掌握无人机的拍摄情况。同时&#xff0c;无人机图传技术也是衡量无人机性能的重要标准&#xff0c;它关乎飞行距离与时间…

Python format函数

在Python编程中&#xff0c;format()函数是一个非常重要且常用的字符串格式化方法&#xff0c;用于将各种数据类型插入到字符串中&#xff0c;并指定其格式。这个函数可以动态地生成各种格式的字符串&#xff0c;包括文本、数字、日期等。本文将深入探讨Python中的format()函数…

openAI:人工智能领域的领军者

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 一、openAI创始人二、openAI的发展历程三、openAI的股权架构四、Sam Altman的离开 一、openAI创始人 openAI由埃隆马斯克、Sam Altman、Greg Brockman三位创始人于…