Maven Plugin

Maven plugin by Jelastic PaaS is a tool that can be used for building and managing Java projects. It complements the native Maven features of standardizing and simplifying the build process through implementation of the best deployment and development practices to deploy local projects directly into the cloud.

Tip: Alternatively, you can manage your project remotely (i.e. from anywhere over the Internet) by creating Maven build node at Jelastic PaaS and storing project at any preferable GIT version control system.

Follow the next steps to deploy your Java applications into Jelastic PaaS with the help of the Maven plugin:

1. Ensure you have a running Java environment to deploy your project into. If needed, create a new one by following the linked guide.

2. Prepare Java project using the Maven build tool (manually or using any IDE).

3. Adjust your project’s pom.xml configuration file by adding/extending the <plugins> and <pluginRepositories> sections. Herewith, you need to substitute placeholders with the correct values (see the comments in the code below):

<plugin>
 <groupId>com.jelastic</groupId>
 <artifactId>jelastic-maven-plugin</artifactId>
 <version>1.9.3</version>
 <configuration>
    <email>{login}</email> <!--your Jelastic account login (email)-->
    <password>{password}</password> <!--your Jelastic account password-->
    <artifact>{artifact}</artifact> <!--artifact to be deployed-->
    <context>{context}</context> <!--preferable context name (ROOT if skipped)-->
    <environment>{envName}</environment> <!--name of a target Jelastic environment-->
    <comment>{comment}</comment> <!--custom comment, if needed-->
   <api_hoster>{hosterDomain}</api_hoster> <!--domain name of your platform-->
 </configuration>
</plugin>

<pluginRepository>
     <id>sonatype-oss-public</id>
     <url>https://oss.sonatype.org/content/groups/public</url>
     <releases>
         <enabled>true</enabled>
     </releases>
     <snapshots>
         <enabled>true</enabled>
     </snapshots>
</pluginRepository>
Note: On accounts with two-factor authentication enabled, a dedicated Maven Plugin access token should be provided as a value for the password parameter.

maven plugin access token
Starting with the 1.9 Maven plugin version, a new <apiToken>{token}</apiToken> parameter could be provided in the pom.xml file instead of the email/password ones.

Don't forget to save the changes.

4. Open the command line on your local machine and navigate to the folder with your maven project. Here, you can perform the following commands:

mvn jelastic:deploy -Djelastic.password={password}

Initiates your application deployment, substitute the {password} placeholder with your actual Jelastic account password (token).

mvn jelastic:publish

Builds and uploads .war file to your account deployment manager without actually deploying project.

mvn clean install jelastic:deploy

Redeploys your project, use it after applying some changes to the code.

5. After successful deployment, you can navigate to your Jelastic dashboard to ensure its addition to the target environment.

java project deployed with maven
To access the deployed application, click the Open in Browser button. In our case it is Hello World application.

project opened in browser
As you can see, the project is successfully built and deployed via Maven.