Tag Archives: Maven

Maven remote deploy

Remote deploy to a Tomcat Server using Maven 3

1. Install maven tomcat7 plugin (you need manager application in tomcat7 – comes by default)

 

2. Configure maven settings.xml in ~/.m2/ (or the place where maven is reading settings.xml)

 

3. Configure tomcat users in /usr/share/apache-tomcat-7.0.39/conf/tomcat-users.xml

 

4. Execute Maven goals

 

5. Tips and Tricks

It is preferable to have a maven profile for each server (DEV, TEST, PROD), in case you have database connections and servers are different. In this way, your war file will be build with predefined IP addresses and parameters for each particular deploy.

Spring Data Mongo DB

Spring MVC Project with maven, mongodb, spring-data

This will contain only snippets of code. There are small dependencies that are not listed in these blocks of code.

I am running mongoDB in a remote Centos 6.2 Server.

Main Database is a PostgreSQL. Upper layers in MVC Service classes will try to fetch data from mongoDB. If is not available, will use SQL DB and update mongoDB. My application uses mongo for caching purposes and writes denormalized relationships in mongoDB.

pom.xml

 

web.xml

 

applicationContext.xml

 

A very simple entity:

A ultra simple Dao Repository:

 

Service class for Repository (contains JPA code for data transfer from JPA Repository to Mongo Repository, can be ignored):

Unit test for this implementation: