源码编译flowable

2020-10-09  本文已影响0人  乌托邦缤果

背景:公司要做工作流的项目,最后确定要用flowable,但是原项目有些功能并不满足我们项目要求,需要调整源码,所以要编译flowable进行二次开发。

官方地址:https://flowable.com/open-source/
源码下载地址(这里用了6.5版本):https://github.com/flowable/flowable-engine/tree/flowable-release-6.5.0
解压导入idea

image.png
从图片可以看到模块中只有部分添加到maven(字体加粗的模块),想要运行起来ui,需要从ui 开始逐级向下编译,只感觉心累,感叹程序猿真苦。编译过程比较简单,但是是真的繁琐。
要是能写个脚本编译就好了。于是
import os

project_path = r'E:\workspace\idea\demo\flowable-engine-flowable-6.5.0\flowable-engine-flowable-6.5.0'
setting_path = r'D:\enviroment\maven\apache-maven-3.5.4-bin\apache-maven-3.5.4\conf\settings.xml'
java_home = r'D:\enviroment\jdk\jdk'
maven_repo_path = r'D:\enviroment\repository'
maven_commod_file = r'D:\enviroment\maven\apache-maven-3.5.4-bin\apache-maven-3.5.4\bin\mvn'
maven_commod = maven_commod_file + " -s " + setting_path + \
    " -Dmaven.repo.local=" + maven_repo_path + \
    " -DskipTests=true" + \
    " install"


def exe_mvn():
    root_mvn_exe()
    modules_path = project_path + "/modules/"
    module_lists = os.listdir(modules_path)
    module_mvn_exe(module_lists)


def root_mvn_exe():
    os.chdir(project_path)
    os.system(maven_commod)


def module_mvn_exe(module_lists):
    # 可以打印需要install的模块,如果程序出错或意外终止,查找最后一次打印的模块,可以接着编译,这里没做任何处理,需要手动处理
    print(*module_lists, sep='\n')
    modules_path = project_path + "/modules/"
    fail_lists = []
    for current_file in module_lists:
        current_path = os.path.join(modules_path, current_file)
        if(os.path.isdir(current_path)):
            os.chdir(current_path)
            ret = os.system(maven_commod)
            if ret == 0:
                print(current_path)
            else:
                fail_lists.append(current_file)
                with open(project_path + "/output.txt", "r") as file:
                    print(file.read())
    if len(fail_lists) > 0:
        module_mvn_exe(fail_lists)


if __name__ == "__main__":
    os.environ['JAVA_HOME'] = java_home
    exe_mvn()

执行,漫长的等待中。。。
执行到最后,一直循环install flowable5-mule-test,也就是只有这个模块没有install成功,直接停掉程序就好了。


image.png

导入mysql数据库


image.png

修改数据库连接


image.png
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/flowable?characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=123456

修改pom 引入mysql依赖(我这里数据库是mysql8.0)


image.png

注:用到的ui项目配置和依赖都要改,例如


image.png

编译完成后,将ui项目添加到maven管理


image.png

等import完成之后,启动starter。如果启动失败,报错找不到类,可以考虑把所有的pom添加到maven里管理,再启动。


image.png

浏览器访问ui
http://localhost:9988/flowable-admin
用户名:admin
密码: test

image.png
执行报错
16:05:43.942 ERROR 4124 --- [nio-9988-exec-1] o.f.u.a.r.c.DeploymentsClientResource    : Error getting deployments

org.flowable.ui.admin.service.engine.exception.FlowableServiceException: An error occurred while calling Flowable: HTTP/1.1 404 

解决办法:
修改数据库表act_adm_server_config
将字段PORT_值改为启动的flowable-task的端口值,比如我这里改为9999。

上一篇下一篇

猜你喜欢

热点阅读