Payara Cloud Maven Plugin User Guide

Introduction

Payara Cloud has a Maven plugin to manage applications in the Payara Cloud environment. The plugin provides commands to log in, deploy, start, stop, undeploy, and enable continuous deployment of applications with live browser reload.

The plugin requires JDK 8 or higher, and the latest version is 1.0-Alpha1.

Configurable Goals

login

Aim: This goal logs in to a Payara Cloud instance. It initiates a browser-based flow to log in to the Payara Cloud management endpoint, and stores the token in the home directory.

Usage: mvn payara-cloud:login

Example:

<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-cloud-maven-plugin</artifactId>
    <version>${payara.cloud.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>login</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Table 1. Configuration tags
Element Default Notes

applicationName

${project.artifactId}

Name of the application.

subscriptionName

First available subscription

Name of the subscription to use. Defaults to the first available subscription if not specified.

namespaceName

First available namespace

Name of the namespace to use. Defaults to the first available namespace if not specified.

interactive

true

If set to true, enables interactive mode.

skip

false

Skips the execution of the goal.

login goal uses OAuth Device Authentication flow to establish its identity to Payara Cloud. It will generate a confirmation code, which you use to log in to Payara Cloud web interface via browser.

mvn payara-cloud:login
INFO: In order to log in follow following link: https://login.payara.cloud/activate
INFO: Your confirmation code is XZHD-CFDJ
INFO: Opening URL: https://login.payara.cloud/activate?user_code=XZHD-CFDJ

The client will also open the browser for you if your environment permits it. In case you follow link manually you’ll need to enter the confirmation code on first page:

login 01 enter code

After that a confirmation page is displayed:

login 02 confirmation

Only confirm this page if you knowingly initiated login flow via pcl login, payara-cloud-maven-plugin or Payara IDE plugins. Payara Cloud will never ask you to authenticate via this flow via any other channel or under any other circumstance, such as solving a support issue.

If you are logging in for the first time the authentication service will ask you to authorize Payara Cloud CLI to perform application management tasks with your identity:

login 03 authorize

After confirming this, the authentication process is completed and you may close the browser window:

login 04 success

Managing tokens

After login is complete the relevant token is stored in $HOME/.payara/manage.payara.cloud. The token does not have any expiration time, so you will not need to log in again for when using pcl. Tokens can be invalidated remotely via User Preferences screen in Payara Cloud Web UI.

deploy

Aim: This goal uploads an application binary and deploys an existing application. It can be used to provide a new binary for an existing application or to upload a new application into a namespace.

Usage: mvn payara-cloud:deploy

Example:

<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-cloud-maven-plugin</artifactId>
    <version>${payara.cloud.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>deploy</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <applicationPath>${project.build.directory}/${project.build.finalName}.war</applicationPath>
        <applicationName>myApp</applicationName>
        <subscriptionName>mySubscriptionName</subscriptionName>
        <namespaceName>myNamespaceName</namespaceName>
    </configuration>
</plugin>
Table 2. Configuration tags
Element Default Notes

applicationPath

${project.build.directory}/${project.build.finalName}.war

Path to the application binary.

applicationName

${project.artifactId}

Name of the application.

subscriptionName

First available subscription

Name of the subscription to use. Defaults to the first available subscription if not specified.

namespaceName

First available namespace

Name of the namespace to use. Defaults to the first available namespace if not specified.

interactive

true

If set to true, enables interactive mode.

skip

false

Skips the execution of the goal.

start

Aim: This goal starts an application in Payara Cloud. It is used when an application is in a stopped state.

Usage: mvn payara-cloud:start

Example:

<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-cloud-maven-plugin</artifactId>
    <version>${payara.cloud.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>start</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <applicationName>myApp</applicationName>
        <subscriptionName>mySubscriptionName</subscriptionName>
        <namespaceName>myNamespaceName</namespaceName>
    </configuration>
</plugin>
Table 3. Configuration tags
Element Default Notes

applicationName

${project.artifactId}

Name of the application.

subscriptionName

First available subscription

Name of the subscription to use. Defaults to the first available subscription if not specified.

namespaceName

First available namespace

Name of the namespace to use. Defaults to the first available namespace if not specified.

interactive

true

If set to true, enables interactive mode.

skip

false

Skips the execution of the goal.

stop

Aim: This goal stops a deployed application in Payara Cloud.

Usage: mvn payara-cloud:stop

Example:

<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-cloud-maven-plugin</artifactId>
    <version>${payara.cloud.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>stop</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <applicationName>myApp</applicationName>
        <subscriptionName>mySubscriptionName</subscriptionName>
        <namespaceName>myNamespaceName</namespaceName>
    </configuration>
</plugin>
Table 4. Configuration tags
Element Default Notes

applicationName

${project.artifactId}

Name of the application.

subscriptionName

First available subscription

Name of the subscription to use. Defaults to the first available subscription if not specified.

namespaceName

First available namespace

Name of the namespace to use. Defaults to the first available namespace if not specified.

interactive

true

If set to true, enables interactive mode.

skip

false

Skips the execution of the goal.

undeploy

Aim: This goal deletes the deployed application from Payara Cloud.

Usage: mvn payara-cloud:undeploy

Example:

<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-cloud-maven-plugin</artifactId>
    <version>${payara.cloud.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>undeploy</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <applicationName>myApp</applicationName>
        <subscriptionName>mySubscriptionName</subscriptionName>
        <namespaceName>myNamespaceName</namespaceName>
    </configuration>
</plugin>
Table 5. Configuration tags
Element Default Notes

applicationName

${project.artifactId}

Name of the application.

subscriptionName

First available subscription

Name of the subscription to use. Defaults to the first available subscription if not specified.

namespaceName

First available namespace

Name of the namespace to use. Defaults to the first available namespace if not specified.

interactive

true

If set to true, enables interactive mode.

skip

false

Skips the execution of the goal.

dev

Aim: The dev goal enables continuous deployment of the application on source code changes with live browser reload.

Usage: mvn payara-cloud:dev

Example:

<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-cloud-maven-plugin</artifactId>
    <version>${payara.cloud.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>dev</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <applicationPath>${project.build.directory}/${project.build.finalName}.war</applicationPath>
        <autoDeploy>true</autoDeploy>
        <liveReload>true</liveReload>
        <browser>chrome</browser>
        <applicationName>myApp</applicationName>
        <subscriptionName>mySubscriptionName</subscriptionName>
        <namespaceName>myNamespaceName</namespaceName>
    </configuration>
</plugin>
Table 6. Configuration tags
Element Default Notes

applicationPath

${project.build.directory}/${project.build.finalName}.war

Path to the application binary.

autoDeploy

true

Enables automatic deployment on file changes.

liveReload

true

Enables live browser reload on deployment.

browser

auto detects

Specifies the browser for live reload.

applicationName

${project.artifactId}

Name of the application.

subscriptionName

First available subscription

Name of the subscription to use. Defaults to the first available subscription if not specified.

namespaceName

First available namespace

Name of the namespace to use. Defaults to the first available namespace if not specified.

interactive

true

If set to true, enables interactive mode.

skip

false

Skips the execution of the goal.

list-subscriptions

Aim

This goal lists all available subscriptions in Payara Cloud.

Usage

mvn payara-cloud:list-subscriptions

Example
<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-cloud-maven-plugin</artifactId>
    <version>${payara.cloud.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>list-subscriptions</goal>
            </goals>
        </execution>
    </executions>
</plugin>
Table 7. Configuration tags
Element Default Notes

interactive

true

If set to true, enables interactive mode.

skip

false

Skips the execution of the goal.

list-namespaces

Aim

This goal lists all available namespaces in Payara Cloud.

Usage

mvn payara-cloud:list-namespaces

Example
<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-cloud-maven-plugin</artifactId>
    <version>${payara.cloud.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>list-namespaces</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <subscriptionName>mySubscriptionName</subscriptionName>
    </configuration>
</plugin>
Table 8. Configuration tags
Element Default Notes

subscriptionName

First available subscription

Name of the subscription to use. Defaults to the first available subscription if not specified.

interactive

true

If set to true, enables interactive mode.

skip

false

Skips the execution of the goal.

list-applications

Aim

This goal lists all deployed applications in Payara Cloud.

Usage

mvn payara-cloud:list-applications

Example
<plugin>
    <groupId>fish.payara.maven.plugins</groupId>
    <artifactId>payara-cloud-maven-plugin</artifactId>
    <version>${payara.cloud.maven.plugin.version}</version>
    <executions>
        <execution>
            <goals>
                <goal>list-applications</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <subscriptionName>mySubscriptionName</subscriptionName>
        <namespaceName>myNamespaceName</namespaceName>
    </configuration>
</plugin>
Table 9. Configuration tags
Element Default Notes

subscriptionName

First available subscription

Name of the subscription to use. Defaults to the first available subscription if not specified.

namespaceName

First available namespace

Name of the namespace to use. Defaults to the first available namespace if not specified.

interactive

true

If set to true, enables interactive mode.

skip

false

Skips the execution of the goal.