Deploying an OSGI module
Deploying an OSGi module is relatively straightforward. Once you have the generated JAR file (in a Maven project it is generated in the target subdirectory), you can simply deploy it to the
digital-factory-data/modules directory of your Digital Experience Manager installation. This can be done whether the server is running or not, it will be picked up and deployed by the server. Every resource in the module (provided it deployed without any errors) will be immediately accessible, including any libraries that have been embedded in the package. If you have declared services in your bundle, they will also be available upon deployment.
Deploying using the Jahia Maven Plugin
During development, you will probably want to deploy and redeploy your module often, so using the
jahia:deploy goal makes this a lot easier to do often. You just need to setup a profile with the location and type of your target server, such as in the following example:
<profile> <id>jahia-8.0-tomcat</id> <properties> <jahia.deploy.targetServerType>tomcat</jahia.deploy.targetServerType> <jahia.deploy.targetServerVersion>8</jahia.deploy.targetServerVersion> <jahia.deploy.targetServerDirectory>/Users/john/java/deployments/jahia-7.2/apache-tomcat-8.0.33 </jahia.deploy.targetServerDirectory> <jahia.debug.address>socket:hostname=localhost,port=8000</jahia.debug.address> </properties> </profile>
You can then simply compile and deploy your module using the following command line:
mvn clean install jahia:deploy -P jahia-8.0-tomcat
Un-deploying/re-deploying a module
If you are using the Jahia Maven Plugin you can simply redeploy a module from the project using the jahia:deploy goal again. Upon deployment in the digital-factory-data/modules directory, Digital Experience Manager will automatically undeploy the old version and deploy the new one. Alternatively, you can also use the administration’s manage modules UI to undeploy the module or remove the jar file from digital-factory-data/modules.