How to deploy .dmn file without using REST API?

I created .dmn file by java code. Now I want to deploy the file in local Camunda Cockpit without using REST APIs. I want to deploy through code (by method call). I want to know whether any library availble to deploy the .dmn file.


Now I want to deploy the file in local Camunda Cockpit

conflicts with

I want to deploy through code (by method call)

Maybe you can clarify a little, but you should be able to do the latter with DeploymentBuilder. Example can be found in a test.

@subash6095 you can use Java API

May I know what dependencies I have to add?

I want to write a java method to deploy the .dmn file. What dependency i have to add in my pom.xml?

I’m somewhat surprised by your question, I assumed since you said you created a DMN programmatically that you were already working with the Camunda Engine Java API. I would expect something like this to already be a part of your project:


I added the dependency which you mention. But I couldn’t find the ProcessEngineTestRule & ProvidedProcessEngineRule classes in that jar. May I know I which jar I can find the above mentioned classes.

I am trying to deploy .dmn file and this is the code. Correct me if there is anything I am missing.

import org.camunda.bpm.engine.RepositoryService;
import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.camunda.bpm.engine.test.util.ProcessEngineTestRule;
import org.camunda.bpm.engine.test.util.ProvidedProcessEngineRule;

public class DMNService {
protected ProcessEngineRule engineRule = new ProvidedProcessEngineRule();
protected ProcessEngineTestRule testRule = new ProcessEngineTestRule(engineRule);
protected RepositoryService repositoryService;
protected static final String DMN_CHECK_ORDER_RESOURCE_DMN_SUFFIX = “/home/ubuntu/Desktop/sampleDMNFile.dmn”;

public void deployDMN() {
    repositoryService = engineRule.getRepositoryService();
    String deploymentId = testRule.deploy(DMN_CHECK_ORDER_RESOURCE_DMN_SUFFIX).getId();

public static void main(String[] args) {
    DMNService dmnService = new DMNService();


Backing up a bit, your original post said

I created .dmn file by java code

I assumed you had something like a DmnModelInstance already in Java. The link I provided was to a test just to show usage of DeploymentBuilder with a DmnModelInstance. Also, you don’t want to mix any of the test harnesses in with your code. I would expect you to create a deployment from the repository service and use the DeploymentBuilder to add the model and deploy. Something more like,


But looking at your code, it looks like you have a standalone DMN file (created in modeler, perhaps?). If you can’t deploy via the modeler (REST), then maybe it would be easier to package and deploy like the quick start guide describes?