There are a lot of resources around for maven. Then why this blog item? Well actually because I want to capture what I do, if someone can use it along the way it would be nice. Therefore this blog item is here. This item describes the merging of my student sample application into a maven project.

First steps for maven:

  • start reading the Maven Getting Started Guide
  • Choose an archetype – These are a sort of project templates that come with maven and can be made company specific. In my case I want to create a web application, there is a mini guideline for webapplications
  • mvn archetype:create -DgroupId=nl.gridshore.registrations -DartifactId=registrations-webapp -DarchetypeArtifactId=maven-archetype-webapp
  • Create java folder under main and test folder under src
  • Copy sources into the java folder and resources into the resources folder
  • Run mvn compile, a lot of libraries are downloaded, and see the compile hopelessly fail. The failing compile is as expected since we need the dependencies during compilation.
  • Find and configure the dependencies. We list all dependencies; compile time, test time and runtime.
  • Install sun files – there is a problem with the license from sun. Therefore they cannot be added to the repository. You need to do this manually. There is a very short item about installing these jars on this page (
    In short : download the classes from the sun site and issue the following command
    mvn install:install-file -Dfile=./ -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar
  • Install jars for mail, activation and connector – same idea as for jta
  • mvn install:install-file -Dfile=activation.jar -DgroupId=javax.activation -DartifactId=activation -Dversion=1.0.2 -Dpackaging=jar  
    mvn install:install-file -Dfile=mail.jar -DgroupId=javax.mail -DartifactId=mail -Dversion=1.3.2 -Dpackaging=jar
    mvn install:install-file -Dfile=connector.jar -DgroupId=javax.resource -DartifactId=connector -Dversion=1.0 -Dpackaging=jar
  • Run the command to create the package
  • mvn package

Now we have a war file that we can deploy, I did not test it yet. I do have some more issues to figure out. While creating the war file, all libraries are copied to web-inf/lib, also all dependencies. Therefore I now have spring.jar and all components jars like spring-core, spring-aop, etc as well. So double jars, to much memory, etc.

Lets move on and try to get the maven site up and running.

  • First try, just generate the site. This gives you the skeleton of the website, but almost no reports yet. You can have a look at your dependencies, nice.
  • mvn site

I must add versioning and maybe some other parts as well, but for now it is enough. In the near future I want to do more with the libraries, I do not want double spring jars etc, and I want to keep foolowing the reports. These reports are not working correct at the moment en they must be improved.

Mavenize the sample