loading...empty;done;/maven-plugin/:-uriMaven Plugin | iNET.elastic Dev Docs

Maven Plugin

Maven plugin by the platform 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 the platform and storing project at any preferable GIT version control system.

Follow the next steps to deploy your Java applications into the platform 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 and sections. Herewith, you need to pass the correct values to placeholders (see the comments in the code below):

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<plugin>
 <groupId>com.iNET.elastic</groupId>
 <artifactId>iNET.elastic-maven-plugin</artifactId>
 <version>1.9.3</version>
 <configuration>
    <apiToken>${token}</apiToken> <!--an access token is used instead of a login/password, see note below-->
    <artifact>{artifact}</artifact> <!--artifact to be deployed-->
    <context>{context}</context> <!--preferable context name (ROOT if skipped)-->
    <environment>{envName}</environment> <!--name of a target 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: You can generate access token for Maven Plugin via the dashboard.

Maven plugin access token

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:

1
mvn iNET.elastic:deploy -DiNET.elastic.password={password}

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

1
mvn iNET.elastic:publish

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

1
mvn clean install iNET.elastic:deploy

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

5. After successful deployment, you can navigate to your platform 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.

What’s next?