Best practice project setup with a separate Magnolia module

Here you find a demo project setup

The ZIP file uses Magnolia version 4.0.1. When changing that to a more recent version, another repository for the Enterprise components is needed: in pom.xml change into


  • parent pom
    • mywebapp (webapp inheriting from the ee webapp)
    • mymodule (copy of our samples module)

Setting up access to the enterprise maven repository

See Maven Setup.

Materialize the webapp

The webapp has no content (no web.xml, ..). This is based on the fact the webapp has a dependency to the Magnolia webapp which contains all relevant files. So unless you need any

  1. call mvn install in the root of the project (to install all poms)
  2. call mvn war:inplace in the webapp folder (to overlay the empty webapp with the Magnolia webapp)
  3. in case you use the maven support of your IDE delete WEB-INF/lib to ensure that you don't get conflicts

Assign enough memory

When not using to start the application server make sure when starting app server (inside or outside of your IDE) you assign it enough of memory, the -Xmx512M and -XX:MaxPermSize=256m are the values recommended for production and should be more then enough for development


Please visit our configuration page explaining how the basic configuration works. In WEB-INF/config/default/ you might like to change the values of:

  • magnolia.repositories.home to a value outside the webapp to not loose the data on redeploys
  • magnolia.bootstrap.samples to false if you want a clean repository without samples
  • to true if you don't want to click you through the installation screens when ever you flush the repository

Copying the jsp from the module to the webapp on changes

Normally the jsp in mgnl-files get extracted in the installation process of a module. But while developing they remain in the classpath (jar) because the installation is not triggered. A convenient solution is to use an ant script which copies the files to the webapp upon changes. In Eclipse you trigger this by adding an ant builder to the project.

An example build.xml file can be found in the mymodule folder.

Building a clean deployable war

(warning) Don't build the war file in the webapp you use in the IDE. You have probably run mvn war:inplace or you have an already bootstrapped repository folder.

  • make a fresh checkout
  • call mvn install

IDE integration

  • No labels

1 Comment

  1. (warning) this page is fairly outdated. We know have archetypes that can generate such a project. JAVA_OPTS are now best set in|.bat, since this is the standard of doing it with Tomcat.