Jspresso webapp using tomcat-maven-plugin

Here is how to setup your Jspresso project to run using “tomcat7-maven-plugin“.

TIPS : This is useful for example if your using IntelliJ IDEA Community


1/ Configure tomcat files

Choose location for tomcat configuration, for example “yourproject/webapp/conf“, to store tomcat configuration files :

  • context.xml
  • jaas.config
  • log4j.xml
  • etc.

NB : You can checkout HRSample from GITHUB to get sample files : https://github.com/jspresso/hrsample-ce


2/ Setup your web app pom.xml 

  • Adapt project name (i.e replace “yourproject” by your project name)
  • Adapt the dependencies according to your needs (database dependency and others)
  • Adapt Java opts and other system properties
  • Put 3 slashes in the file: url below if you run under windows
                    <warDirectory> ${project.build.directory}/yourproject-webapp</warDirectory> 
                        <JAVA_OPTS>-Xms256m -Xmx512m -Xmx1024m -XX:MaxPermSize=256m</JAVA_OPTS> 


3/ Build your project using “mvn install”

This has to be done once only, all artefact will be packaged and stored into your maven repository… only the “core” and “webapp” module will be rebuild at launch time. See bellow.


4/ Create a run configuration

Here is an IntelliJ IDEA example for HRSample app :

  • Go to menu “Run” then “Edit configurations…”
  • Click “+” button on top left and select “Maven”
  • Feed the formular as bellow
    • Command line :
    • tomcat7:run-war -pl webapp
    • Add a “Before launch” to install core and web app before launching tomcat :
      install -pl  core,webapp -P!generate-ddl-scripts -DskipTests -DdisableAttachJavadocs -DdisableAttachSources


5/ Run your app !

It’s done !


Categories: IDE

Leave a Reply