Skip to content

Cloud hosting with Maven plugin: locally build and automatically deploy Java to the cloud

by on October 21, 2011

As you probably know, Maven is a tool that can be used for building and managing Java projects. It makes the build process easy, provides a uniform build system, quality project information, guidelines for best practices development, allows transparent migration to new features.

We have good news for developers who use Maven. You can now automatically deploy your projects to your environments in Jelastic!

Here’s what you do:

  1. Go to jelastic.com and sign-up if you haven’t already,
  2. Login with your Jelastic credentials by clicking the Log In link on the page,
  3. Create your environment in Jelastic,
  4. Specify  the resource limits you want to be set for the environment you want to use and specify your environment name (an example below):
  5. Install Maven (if you don’t have it installed yet),
  6.  Modify configuration files: settings.xml & pom.xml like shown below:

settings.xml

Add the following tags (Profile and Plugin Repository) to your settings.xml file. In this block developer specifies authentication information:

        <profile>
            <id>jelastic</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <jelastic.username>[insert your Jelastic username]</jelastic.username>
                <jelastic.password>[insert your Jelastic password]</jelastic.password>
            </properties>
        </profile>

Add block Plugin Repository to settings.xml:

        <pluginRepository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>plugins-release</name>
            <url>http://maven.jelastic.com/plugins-release</url>
        </pluginRepository>
        <pluginRepository>
            <snapshots/>
            <id>snapshots</id>
            <name>plugins-snapshot</name>
            <url>http://maven.jelastic.com/plugins-snapshot</url>
        </pluginRepository>

pom.xml

Add to your pom.xml file the dependency section:

<plugins>
<!-- ... -->
 <plugin>
  <groupId>com.jelastic</groupId>
  <artifactId>jelastic-maven-plugin</artifactId>
  <version>[1.5,)</version>
  <configuration>
     <email>${jelastic.username}</email>
     <password>${jelastic.password}</password>
     <context><!-- insert your context path or ROOT for default --></context>
     <environment><!-- insert your environment name --></environment>
     <api_hoster><!-- default value "api.jelastic.com" --></api_hoster>
  </configuration>
 </plugin>
<!-- ... -->
</plugins>

Insert in <api_hoster> tag api.jelastic.com if you are registered on Host Europe server or jelastic.servint.net if you are registered on Servint.

7. Now, all you need to initiate your application deployment, is just type this command line on your Windows or Linux computer:

mvn jelastic:deploy

From → HowTo

8 Comments
  1. I’m getting “peer not authenticated” when I run mvn jelastic:deploy. What can I do?

    [INFO] — jelastic-maven-plugin:1.5:deploy (default-cli) @ my-app —
    [ERROR] peer not authenticated
    javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
    at com.sun.net.ssl.internal.ssl.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:352)
    at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:128)
    at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:390)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:148)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:561)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:941)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:919)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:910)

    [INFO] ————————————————————————
    [INFO] Authentication : SUCCESS
    [INFO] Session : null
    [INFO] ————————————————————————

  2. Ok, this has something to do with the company proxy-server :-( . Running the mvn jelastic:deploy from my home-network works fine!

    • Hi Ivar! Now you can also build applications in Jelastic cloud instead of building your projects locally and uploading WAR archives. Jelastic has new feature – build node Maven.

  3. Wow! This could be one particular of the most helpful blogs Weve ever arrive across on this subject. Basically Excellent. Im also an expert in this topic therefore I can understand your effort. 104260

Trackbacks & Pingbacks

  1. Jelastic Newsletter – Nov 4, 2011 « Elastic Java Cloud – Platform as a Service
  2. Lothar Schulz » elastic java
  3. Maven Repository Concepts: Releases vs Snapshots repository | Sing's Tech Musings

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 95 other followers