1. 程式人生 > >flowable-engine6.3.1原始碼編譯

flowable-engine6.3.1原始碼編譯

最近專案要整合流程引擎,專案本身使用的是springboot,網上搜索鋪天蓋地的是Activiti和Flowable。兩者區別大家自行百度。最後選擇的是Flowable的最新版本6.3.1。

1、下載原始碼

2、解壓

將原始碼的zip包解壓後方到指定的目錄,修改目錄名稱為:flowable-engine。

3、開啟原始碼

這裡使用的是IDEA的開發環境,直接用IDEA開啟flowable-engine目錄。此時需要等待較長的時間讓其自行解決Maven的依賴。

4、修改原始碼

4.1、修改工程中根pom檔案。將第一個<modules>標籤中的內容替換:(大概在第953行)

<modules>
		<module>modules/flowable-bpmn-model</module>
		<module>modules/flowable-process-validation</module>
		<module>modules/flowable-image-generator</module>
		<module>modules/flowable-bpmn-converter</module>
		<module>modules/flowable-engine</module>
		<module>modules/flowable-secure-javascript</module>
		<module>modules/flowable-groovy-script-static-engine</module>
		<module>modules/flowable-bpmn-layout</module>
		<module>modules/flowable-json-converter</module>
		<module>modules/flowable-spring-common</module>
		<module>modules/flowable-engine-configurator</module>
		<module>modules/flowable-spring-configurator</module>
		<module>modules/flowable-app-engine-spring</module>
		<module>modules/flowable-app-engine-rest</module>
		<module>modules/flowable-dmn-model</module>
		<module>modules/flowable-dmn-json-converter</module>
		<module>modules/flowable-dmn-xml-converter</module>
		<module>modules/flowable-dmn-engine</module>
		<module>modules/flowable-dmn-engine-configurator</module>
		<module>modules/flowable-dmn-spring</module>
		<module>modules/flowable-dmn-spring-configurator</module>
		<module>modules/flowable-dmn-rest</module>
		<module>modules/flowable-dmn-api</module>
		<module>modules/flowable-cmmn-api</module>
		<module>modules/flowable-cmmn-model</module>
		<module>modules/flowable-cmmn-converter</module>
		<module>modules/flowable-cmmn-json-converter</module>
		<module>modules/flowable-cmmn-engine</module>
		<module>modules/flowable-cmmn-engine-configurator</module>
		<module>modules/flowable-cmmn-spring</module>
		<module>modules/flowable-cmmn-spring-configurator</module>
		<module>modules/flowable-cmmn-rest</module>
		<module>modules/flowable-form-model</module>
		<module>modules/flowable-form-json-converter</module>
		<module>modules/flowable-form-engine</module>
		<module>modules/flowable-form-engine-configurator</module>
		<module>modules/flowable-form-spring</module>
		<module>modules/flowable-form-spring-configurator</module>
		<module>modules/flowable-form-rest</module>
		<module>modules/flowable-content-engine</module>
		<module>modules/flowable-content-engine-configurator</module>
		<module>modules/flowable-content-spring</module>
		<module>modules/flowable-content-spring-configurator</module>
		<module>modules/flowable-content-rest</module>
		<module>modules/flowable-common-rest</module>
		<module>modules/flowable-rest</module>
		<module>modules/flowable-app-rest</module>
		<module>modules/flowable-idm-engine-configurator</module>
		<module>modules/flowable-idm-spring</module>
		<module>modules/flowable-idm-spring-configurator</module>
		<module>modules/flowable-idm-rest</module>
		<module>modules/flowable-spring</module>
		<module>modules/flowable5-engine</module>
		<module>modules/flowable5-compatibility</module>
		<module>modules/flowable5-spring</module>
		<module>modules/flowable5-spring-compatibility</module>
		<module>modules/flowable-spring-boot</module>
		<module>modules/flowable-cxf</module>
		<module>modules/flowable-mule</module>
		<module>modules/flowable-http</module>
		<module>modules/flowable-camel</module>
		<module>modules/flowable-camel-cdi</module>
		<module>modules/flowable-cdi</module>
		<module>modules/flowable-osgi</module>
		<module>modules/flowable-ldap</module>
		<module>modules/flowable-ldap-configurator</module>
		<module>modules/flowable-jmx</module>
		<module>modules/flowable-jms-spring-executor</module>
		<module>modules/flowable-ui-common</module>
		<module>modules/flowable-ui-edge</module>
		<module>modules/flowable-ui-idm</module>
		<module>modules/flowable-ui-modeler</module>
		<module>modules/flowable-ui-task</module>
		<module>modules/flowable-ui-admin</module>
		<module>tooling/archetypes/flowable-archetype-unittest</module>
	</modules>

4.2、如果資料庫想使用mysql,參考如下:其他資料庫配置類似

根pom檔案找到mysql的依賴,將其<scope>test</scope>這行註釋掉。

分別找到flowable-ui-admin、flowable-ui-idm、flowable-ui-modeler、flowable-ui-task著四個module。分別修改它們下面的各個app子modules的pom、fowable-default.properties檔案(其中flowable-ui-admin中還需要修改其resources目錄下的application-dev.properties檔案)

子pom檔案:新增下圖中的依賴,原來的h2保留或刪除都可以,我的是保留了,沒刪。

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

fowable-default.properties檔案:註釋掉原來h2的驅動和url,修改資料庫連線的使用者名稱和密碼。

#spring.datasource.url=jdbc:h2:tcp://localhost/flowableadmin
#spring.datasource.url=jdbc:h2:~/flowable-db/db;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=9091;DB_CLOSE_DELAY=-1

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.1.146:3306/flowable?characterEncoding=UTF-8

#spring.datasource.driver-class-name=org.postgresql.Driver
#spring.datasource.url=jdbc:postgresql://localhost:5432/flowableadmin

#spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.url=jdbc:sqlserver://localhost:1433;databaseName=flowableadmin

#spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
#spring.datasource.url=jdbc:oracle:thin:@localhost:1521:FLOWABLEADMIN

#spring.datasource.driver-class-name=com.ibm.db2.jcc.DB2Driver
#spring.datasource.url=jdbc:db2://localhost:50000/flowableadmin

spring.datasource.username=root
spring.datasource.password=12345

4.3、編譯

編譯截圖
標題

編譯成功後分別啟動idm、admin、modeler、task四個module。啟動成功,瀏覽器位址列輸入:http://localhost:8888/flowable-modeler。彈出登入頁面的使用者名稱和密碼分別是admin/test。

至此,原始碼編譯完成。