Integrate tomcat deployment to your maven lifecycle

If we want to integrate tomcat deployment to our maven script you should follow the these steps:
1. Have these tomcat rules at tomcat-users.xml:
[code language=”xml”]
<role rolename="tomcat"/>
<role rolename="manager-gui"/>
<role rolename="admin"/>
<role rolename="manager-script"/>
<user username="admin" password="admin" roles="admin,manager"/>
<user username="managerGui" password="managerPwd" roles="manager-gui"/>
<user username="manager" password="managerPwd" roles="manager-script"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>
2. Adjust maven settings.xml file:
  2a. In order to check from where Maven load your settings.xml file run mvn -X.
  2b. Add this to settings.xml file:
[code language=”xml”]


3. Adjust maven pom.xml:
[code language=”xml”]
4. run mvn tomcat7:redeploy
That’s it,

Generate domain classes with JaxB from XSD file

We got our domain described with XSD.
Will be very convenient and fast to generate our Domain objects straight from XSD.
JaxB is here for this mission.
JaxB will take xml scheme and create Java classes according to it
1. First download the latest jaxb distribution.
2. Let’s say our xsd file is: MyData.xsd
On the command line run this:
xjc -target 2.1 -extension -d src -p my.package.test MyData.xsd
-target = stands for the jaxb version target
-d src = stands for the target dir where to place the generated sources.
-p my.package.test= stands for the defined package
-extention= ignore some jaxb spec rules
MyData.xsd= stands for the target xsd file
After execution the generated sources will be ready in the target for use in your project.