Payara Micro Maven Plugin

Payara Micro has a Maven plugin which can start and stop Payara Micro and create an Uber JAR bundle of the application and Payara Micro.

The plugin requires JDK 8 or higher and the latest version is currently 1.0.1

Configurable Goals

bundle

Aim: This goal bundles the attached project’s artifact into an Uber JAR with the specified configurations. By default this goal is attached to the install phase. Usage: mvn payara-micro:bundle

Example:

    <plugin>
        <groupId>fish.payara.maven.plugins</groupId>
        <artifactId>payara-micro-maven-plugin</artifactId>
        <version>${payaramicro.maven.plugin.version}</version>
        <executions>
            <execution>
                <goals>
                    <goal>bundle</goal>
                </goals>
            </execution>
        </executions>
        <configuration>
            <startClass>my.custom.start.class.Main</startClass>
            <deployArtifacts>
                <artifactItem>
                    <groupId>org.mycompany</groupId>
                    <artifactId>my-project</artifactId>
                    <version>1.0</version>
                    <type>ear</type>
                </artifactItem>
            </deployArtifacts>
            <customJars>
                <artifactItem>
                    <groupId>org.primefaces</groupId>
                    <artifactId>primefaces</artifactId>
                    <version>6.0</version>
                </artifactItem>
            </customJars>
        </configuration>
    </plugin>
Table 1. Configuration tags
Element Default Notes

autoDeployArtifact

true

If the extension of the produced artifact is WAR, it will be copied automatically to the MICRO-INF/deploy directory when this property is set to true.

autoDeployContextRoot

none

Sets context root of the deployed artifact if autoDeployArtifact is true. autoDeployContextRoot has the higher precedence compared to the autoDeployEmptyContextRoot.

autoDeployEmptyContextRoot

true

Sets context root of the deployed artifact to / if autoDeployArtifact is true. If set to false, context root is derived from project.build.finalName. If autoDeployContextRoot is specified, autoDeployEmptyContextRoot will be ignored.

startClass

(optional):

Replaces the Start-Class definition that resides in the MANIFEST.MF file with the provided class.

appendSystemProperties

true

Appends all system properties defined into the payara-boot.properties file.

payaraVersion

5.182

By default bundle mojo fetches payara-micro with version 5.182.

deployArtifacts

None

Can contain a list of artifactItems, which defines the dependencies with their GAVs to be copied under MICRO-INF/deploy folder.

customJars

None

Can contain a list of artifactItems, which defines the dependencies with their GAVs to be copied under MICRO-INF/lib folder.

start

Aim: This goal starts Payara Micro with the specified configuration.

Usage: mvn payara-micro:start

Example:

<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-micro-maven-plugin</artifactId>
    <version>${payaramicro.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>start</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <useUberJar>true</useUberJar>
        <payaraMicroAbsolutePath>/path/to/payara-micro.jar</payaraMicroAbsolutePath>
        <payaraVersion>5.182</payaraVersion>
        <artifactItem>
            <groupId>fish.payara.extras</groupId>
            <artifactId>payara-micro</artifactId>
            <version>5.182</version>
        </artifactItem>
        <daemon>true</daemon>
        <javaPath>/path/to/Java/Home</javaPath>
        <deployWar>true</deployWar>
        <copySystemProperties>true</copySystemProperties>
        <javaCommandLineOptions>
            <option>
                <value>-Xdebug</value>
            </option>
            <option>
                <key>-Xrunjdwp:transport</key>
                <value>dt_socket,server=y,suspend=y,address=5005</value>
            </option>
        </javaCommandLineOptions>
        <commandLineOptions>
            <option>
                <key>--domainconfig</key>
                <value>/path/to/domain.xml</value>
            </option>
            <option>
                <key>--autoBindHttp</key>
                <value>true</value>
            </option>
        </commandLineOptions>
    </configuration>
</plugin>
Table 2. Configuration tags
Element Default Notes

useUberJar

false

Use created uber-jar that resides in target folder. The name of the JAR artifact will be resolved automatically by evaluating its final name, artifact ID and version. This configuration element has the higher precedence compared to payaraMicroAbsolutePath, payaraVersion and artifactItem.

payaraMicroAbsolutePath

none

Absolute path to payara-micro executable.

payaraVersion

5.182

By default start mojo fetches payara-micro with version 5.182.

artifactItem

none

Defines payara-micro artifact with its coordinates. Specified artifact should be available in local maven repository.

daemon

false

Starts payara-micro in separate JVM process and continues with the maven build.

immediateExit

false

If payara-micro is executed in daemon mode, the executor thread will wait for the ready message before shutting down its process. By setting immediateExit to true you can skip this and instantly interrupt the executor thread.

javaPath

java

Absolute path to the java executable.

deployWar

false

If the attached project is of type WAR, it will automatically be deployed to payara-micro if deployWar is set to true.

copySystemProperties

false

Allows passing all system properties available within the maven build to the payara-micro execution.

javaCommandLineOptions

none

Defines a list of command line options that will be passed to java executable. Command line options can either be defined as key-value pairs or just as list of values. key-value pairs will be formatted as key=value.

commandLineOptions

none

Defines a list of command line options that will be passed onto payara-micro.

stop

Aim: This goal stops Payara Micro with the specified configuration. By default this goal tries to find the currently executing Payara Micro instance by checking the running uberjar. If an artifactItem is defined, it will take precedence for identifying currently running instances. If processId is defined, this takes the highest precedence and the given processId will immediately kill the executing Payara Micro instance.

Usage: mvn payara-micro:stop

Example:

<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-micro-maven-plugin</artifactId>
    <version>${payaramicro.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>stop</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <processId>32333</processId>
        <artifactItem>
            <groupId>fish.payara.extras</groupId>
            <artifactId>payara-micro</artifactId>
            <version>5.182</version>
        </artifactItem>
    </configuration>
</plugin>
Table 3. Configuration tags
Element Default Notes

processId

none

Process id of the running payara-micro.

artifactItem

none

Defines payara-micro artifact with its coordinates. This information is used to identify the process id of the running payara-micro.

results matching ""

    No results matching ""