User Guide

"Manik Hot deploy" is a Maven Plugin that simplifies your web development. The plugin provides both deployment modes - the auto-deployment and also the hot-deployment. It takes only some seconds to configure your maven project and you can use it for simple web applications as also for multi-module projects. The following section shows how to use the manik-hot-deploy plugin in your Maven project.

How to Add the Plugin

To use "Manik Hot deploy" you simply add the plugin into the plugins section of your pom.xml

  ....
  <build>
    <plugins>
    .....
      <!-- Manik Hotdploy -->
      <plugin>
        <groupId>org.imixs.maven</groupId>
        <artifactId>manik-hotdeploy-maven-plugin</artifactId>
        <version>2.0.0</version>
        <executions>
          <execution>
            <phase>install</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <!-- List Source and Target folders for Autodeploy and Hotdeploy -->
          <autodeployments>
            <deployment>
              <!-- wildcard deployment -->
              <source>target/*.{war,ear,jar}</source>
              <target>docker/deployments/</target>
              <unpack>true</unpack>						
            </deployment>
            </autodeployments>
            <hotdeployments>
              <deployment>
                <source>src/main/webapp</source>
                <target>docker/deployments/my-app.war</target>
              </deployment>						
            </hotdeployments>
          </configuration>
        </plugin>
        .....
      </plugins>
    </build>
    ....		
	

Auto-Deployment

After you have enabled the manik-hot-deploy plugin in your pom.xml auto-deployment will be activated whenever you run the maven goal install:

$ mvn clean install

$ mvn clean install
....
......
[INFO] --- manik-hotdeploy-maven-plugin:2.0.0:deploy (default) @ my-app ---
[INFO] Starting auto deployment....
[INFO] ..... source: /home/git/my-app/target/*.{war,ear,jar}
[INFO] ..... target: /home/git/my-app/docker/deployments
[INFO] ..... deploy: /home/git/my-app/target/imixs-app.war : unpack=true
[INFO] 1 auto-deployments completed.

Hot-Deployment

After your artifact was successful auto-deployed you can run the maven goal hotdeploy:

$ mvn manik-hotdeploy:hotdeploy

$ mvn manik-hotdeploy:hotdeploy
....
[INFO] --- manik-hotdeploy-maven-plugin:2.0.0:hotdeploy (default-cli) @ my-app ---
[INFO] ..... source: /home/git/my-app/src/main/webapp
[INFO] ..... target: /home/git/my-app/docker/deployments/my-app.war
[INFO] ..... watching hot-deployments...

The manik-hot-deploy plugin starts watching your source code folder and automatically deploys code changes into your running application server.

Configuration

The configuration of the manik-hot-deploy plugin consists of two sections - <autodeployment> and <hotdeployment>. Each deployment configuration has a source and target path.

<autodeployment>

The following example shows an auto-deployment configuration:

    <autodeployments>
      <deployment>
        <source>target/*.{war,ear,jar}</source>
        <target>/opt/jboss/wildfly/standalone/deployments//</target>
        <unpack>true</unpack>						
      </deployment>
    </autodeployments>

In this example for a Wildfly Application server the source tag points to any artifact build by maven. This will typically be your .war file. The target tag points to the deployments folder of your Wildfly Server located at /opt/jboss/wildfly. The manik-hot-deploy plugin will automatically unzip the artifact as this is needed for some web and application servers. (See also examples for Wildfly and Payara servers below).

Note: You can define multiple auto-deployments either if your project is a multi-module project, containing several artifacts or if you want to deploy your artifact to different target platforms (e.g. different application severs running in a test suite)

<hotdeployment>

The hot-deployment configuration is similar but pointing to your source code folder:

     <hotdeployments>
       <deployment>
         <source>src/main/webapp</source>
         <target>/opt/jboss/wildfly/standalone/deployments/my-app.war</target>
       </deployment>						
     </hotdeployments>

The source points typically to the /src/main/webapp/ folder of your web project. The target again points to your web server.

The following table gives a overview about the different configuration settings to be used:

<autdeployments>

Tag Description Example
<source> Path pointing to the artifact build by maven. You can use relative path (without leading /) or an absolute path description.
In addition you can use java file-wildcard descriptors like *.{war,ear,jar}
target/my-app.war

/git/my-appp/target/my-app.war

target/*.{war,ear,jar}
<target> Path pointing to the auto-deplyoment folder of your application sever. You can use relative path (without leading /) or an absolute path description. The location depends on your server type. You can also use docker containers. In this case you just have to add a local volume to your docker container. /opt/jboss/wildfly/standalone/deployments/

docker/deployments/
<unzip> If set to true the artifact will be automatically unziped into the target folder

<hotdeployments>

Tag Description Example
<source> Path pointing to the source code folder of your web application. Typical /src/main/webapp/ /src/main/webapp

<target> Path pointing to the deployed application in your running application sever. The location depends on your server type.
Node: For Wildfly server you need the 'unzip' option in the auto-deployment to expand the artifact. Payara server will do this automatically.
/opt/jboss/wildfly/standalone/deployments/my-app.war

Wildfly

This section explains how the setup for auto-deployment and hot-deployment may look for Wildfly Servers Let's assume your maven web application pom.xml looks like this:

....
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>11</maven.compiler.source>
		<maven.compiler.target>11</maven.compiler.target>
		<failOnMissingWebXml>false</failOnMissingWebXml>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>3.3.2</version>
			</plugin>
		</plugins>
		<finalName>my-app</finalName>
	</build>
....

And your Wildfly Server is installed in the folder /opt/jboss/wildfly/. Then the auto-deployment location for your server is

/opt/jboss/wildfly/standalone/deployments/

The "Manik Hot deploy" for your app will look like this:

    .....
      <plugin>
        <groupId>org.imixs.maven</groupId>
        <artifactId>manik-hotdeploy-maven-plugin</artifactId>
        <version>2.0.0</version>
        <executions>
          <execution>
            <phase>install</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <autodeployments>
            <deployment>
              <source>target/*.war</source>
              <target>/opt/jboss/wildfly/standalone/deployments/</target>
              <unpack>true</unpack>						
            </deployment>
            </autodeployments>
            <hotdeployments>
              <deployment>
                <source>src/main/webapp</source>
                <target>/opt/jboss/wildfly/standalone/deployments/my-app.war</target>
              </deployment>						
            </hotdeployments>
          </configuration>
        </plugin>
        .....
	

The auto-deployment source is target/*.war. Here we use a wildcard to select the generated .war file form the maven build process. The target is the auto-deployment location mentioned before. The tag unzip is used to tell manik to unzip the web artifact. This is needed fro the hotdeploy feature.
The hot-deplomynet source is the source directory of your web application: src/main/webapp. And the target is the deployment location inside your wildfly application server

Now you can build your web application which will automatically deploy the app into your running wildfly server

mvn clean install

...and you can start the hot-deployment:

mvn manik-hotdeploy:hotdeploy

That's it!

Payara / Glassfish

This section explains how the setup for auto-deployment and hot-deployment may look for Payara Servers Again let's assume your maven web application pom.xml looks like this:

....
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>11</maven.compiler.source>
		<maven.compiler.target>11</maven.compiler.target>
		<failOnMissingWebXml>false</failOnMissingWebXml>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>3.3.2</version>
			</plugin>
		</plugins>
		<finalName>my-app</finalName>
	</build>
....

...and your Payara Server is installed in the folder /opt/payara/. Then the auto-deployment location for your default domain 'production' is

/opt/payara/appserver/glassfish/domains/production/autodeploy/

The "Manik Hot deploy" for your app will look like this:

    .....
      <plugin>
        <groupId>org.imixs.maven</groupId>
        <artifactId>manik-hotdeploy-maven-plugin</artifactId>
        <version>2.0.0</version>
        <executions>
          <execution>
            <phase>install</phase>
            <goals>
              <goal>deploy</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <autodeployments>
            <deployment>
              <source>target/*.war</source>
              <target>/opt/payara/appserver/glassfish/domains/production/autodeploy/</target>
              <unpack>true</unpack>						
            </deployment>
            </autodeployments>
            <hotdeployments>
              <deployment>
                <source>src/main/webapp</source>
                <target>/opt/payara/appserver/glassfish/domains/production/applications/my-app.war</target>
              </deployment>						
            </hotdeployments>
          </configuration>
        </plugin>
        .....
	

The auto-deployment source is target/*.war. Here we use again a wildcard to select the generated .war file form the maven build process. The target is the auto-deployment location mentioned before. We do not need to explicit unzip the artifact as this his done be Payara automatically.
The hot-deplomynet source is the source directory of your web application: src/main/webapp. And the target is the deployment location /applications/[YOUR_APP]/ inside your payara domain directory.

Now you can build your web application which will automatically deploy the app into your running Payara server

mvn clean install

...and you can start the hot-deployment:

mvn manik-hotdeploy:hotdeploy

That's it!