Payara
April 4, 2018

Payara Micro Maven Plugin

Here is GAV (groupId, artifactId, version) of Payara Micro Maven Plugin.

Key Value
groupId fish.payara.maven.plugins
artifactId payara-micro-maven-plugin
version 1.0.3

Payara Micro Maven Plugin has three goals; payara-micro:bundle, payara-micro:start and payara-micro:stop.

Goal Description
payara-micro:bundle Create Uber Jar
payara-micro:start Start the application on Payara Micro
payara-micro:stop Stop the application on Payara Micro

Then minimal description on pom.xml is here:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
<build>
  <plugins>
    <plugin>
      <groupId>fish.payara.maven.plugins</groupId>
      <artifactId>payara-micro-maven-plugin</artifactId>
      <version>1.0.3</version>
      <configuration>
          <payaraVersion>5.184</payaraVersion>
          <deployWar>true</deployWar>
          <commandLineOptions>
              <option>
                  <key>--autoBindHttp</key>
              </option>
          </commandLineOptions>
      </configuration>
    </plugin>
  </plugins>
</build>

After the goal, two files will appear in ./target directory.

  • application-name.war (e.g. helloweb-1.1.0.war, which is Micro Jar)
  • application-name-microbundle.jar (e.g. helloweb-1.1.0-microbundle.jar, which is Uber Jar)

We may run it either on CLI directly or via the plugin’s goals; payara-micro:bundle, payara-micro:start and payara-micro:stop. The way to use the plugin can be integrated with any IDEs, so we’re able to develop applications for Payara Micro easily even if we don’t use Payara Server.

Using CLI

Download Payara Micro (payara-micro.jar) first, then deploy Micro Jar using cli

1
java -jar payara-micro.jar --deploy ./target/helloweb-1.1.0.jar

Using plugin’s goals

Deploying Uber Jar

1
2
3
4
# to create Uber Jar
mvn payara-micro:bundle
# to deploy Uber Jar
java -jar ./target/helloweb-1.1.0-microbundle.jar

Deploying Micro Jar

1
2
3
4
# to start the application on Payara Micro
mvn clean package payara-micro:start
# to stop the application on Payara Micro
mvn payara-micro:stop