try {
//獲取文件流
File fileBpmn = new File('bpmn文件絕對地址');
InputStream BpmnInputStream = null;
try {
BpmnInputStream = new FileInputStream(fileBpmn);
} catch (IOException e) {
}
File fileSvg = new File('png/svg 文件絕對地址');
InputStream SvgInputStream = null;
try {
SvgInputStream = new FileInputStream(fileSvg);
} catch (IOException e) {
}
//1.創建ProcessEngine對象
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
//2.得到RepositoryService實例
RepositoryService repositoryService = processEngine.getRepositoryService();
//3.進行部署
Deployment deployment = repositoryService.createDeployment()//創建Deployment對象
.name('name')
.key('')
.category('')
.tenantId("000000")
.addInputStream(fileBpmn.getName(), BpmnInputStream)//添加bpmn文件
.addInputStream(fileSvg.getName(), SvgInputStream)//添加png/svg文件
.deploy();//部署
log.info("name---" + deployment.getName());
} catch (Exception e) {
e.printStackTrace();
}