Cloud hosting with Maven plugin: locally build and automatically deploy Java to the cloud
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:
- Go to jelastic.com and sign-up if you haven’t already,
- Login with your Jelastic credentials by clicking the Log In link on the page,
- Create your environment in Jelastic,
- Specify the resource limits you want to be set for the environment you want to use and specify your environment name (an example below):
- Install Maven (if you don’t have it installed yet),
- 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
Blog
Twitter
YouTube
Facebook
Google+
Habrahabr
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] ————————————————————————
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.
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
Thanks! Nice to know that people appreciate our work.