I need to deploy an ear file to wildfly server.
When copying the ear file to deployment folder of wildfly and starting the server, it is getting deployed. But that is not my requirement. I want to deploy it using jboss-cli. When I opened jboss-cli manually and executed the below command it is getting deployed.
jboss-cli.bat --connect --command="deploy --force C:\\Users\\jmk\\git\\ec\\EC\\build\\libs\\test.ear"
Now I have to execute this command using Java code. I tried the below code:
ProcessBuilder pb = new ProcessBuilder("jboss-cli.bat", "--connect", "--command","\"deploy --force C:\\Users\\jmartin5\\git\\ecommerce\\ECommerce\\build\\libs\\ECommerce.ear\"");
Process p = pb.start();
But the deployment is not happening.
How to write some code to deploy using ProcessBuilder()?