Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Code for auto deploying your custom component


Former Community Member

I wrote an ant script for creating my components for me. It was still tedius to deploy them over and over in Workbench. I wrote the java app below (much of the setup is from sample files in help). I configured my Java project in my IDE to use this file as what runs and to run my ant task to build the component before running. So I can just change code, hit the quick key for run and my new code is deployed on the server to test.

import com.adobe.idp.Document;

import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;

import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;

import com.adobe.idp.dsc.registry.component.client.ComponentRegistryClient;

import com.adobe.idp.dsc.registry.infomodel.Component;

import java.io.FileInputStream;

import java.util.Properties;

public class DeployComponents {

      public static void main(String[] args) {


              //Set connection properties required to invoke LiveCycle ES2                               

            Properties connectionProps = new Properties();

            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_SOAP_ENDPOINT, "Your Server");


            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");

            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "Your ID");

            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "Your Password");

            //Create a ServiceClientFactory object

            ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

            //Create a ComponentRegistryClient object

            ComponentRegistryClient    componentReg = new ComponentRegistryClient(myFactory);

            //Reference a JAR file that represents the component to deploy

            FileInputStream componentFile = new FileInputStream("Your File");

            Document docComponent = new Document(componentFile);

            //Install the component

            Component myComponent;

            System.out.println("Getting current component instance.");

            myComponent = componentReg.getComponent("Name of component you put in component.xml", "version of component");

            if (myComponent.getState() != Component.STOPPED) {

                System.out.println("Stopping current component instance.");

                myComponent = componentReg.stop(myComponent);


            while (myComponent.getState() != Component.STOPPED) {



                myComponent = componentReg.getComponent("Name of component you put in component.xml", "version of component");



            System.out.println("Uninstalling current component instance.");


            myComponent = componentReg.install(docComponent);


            System.out.println("The component has been deployed");


        catch(Exception e)






0 Replies