How to convert Java web project to Maven based project

There is no exact or official solution to convert an existing Java web project to a Maven based web application project. Basically, the Maven based project conversion will involve two major changes, which is :

  1. Folder structure – Follow this Maven’s folder structure.
  2. Dependency library – Put all your dependency libraries in pom.xml file.

Steps to convert Java based –> Maven based

This guide will show you how to convert the following servlet web application to Maven based structure, and support Eclipse IDE.

Existing Java web project structure
A simple Java servlet web application , with one “javaee.jar” dependency library

Existing Java web project structure
Tags :

About the Author

Founder of and, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.


  • Pingback: see()

  • Pingback: over here()

  • Pingback: alkaline water()

  • Pingback: pay plan()

  • Pingback: visit site()

  • Pingback: pay day loans()

  • Pingback: bottled alkaline water()

  • Pingback: plan()

  • Pingback: house blue()

  • Pingback: zak?ad szklarski piotrków trybunalski()

  • Pingback: parking()

  • Pingback: locksmiths 4 u()

  • Pingback: craigslist locksmith tools for sale()

  • Pingback: going here()

  • Pingback: check here()

  • Pingback: water ionizer plans()

  • Pingback: paypal loans()

  • Pingback: water ionizers()

  • Pingback: alkaline water machine()

  • Pingback: her og nu laan()

  • Pingback: lane penge()

  • Pingback: lan penge billigt()

  • Pingback: parking()

  • Pingback: mp4 mobile porn()

  • Pingback: Sat TV()

  • Pingback: tv packages()

  • Pingback: Felicity mercy fuma sul terrazzo e poi spompina uno()

  • Pingback: online casinos()

  • Pingback: kangen water()

  • Pingback: alkaline water benefits()

  • Pingback: alkaline water()

  • Pingback: alkaline water()

  • Pingback: streaming movies()

  • Pingback: free movie downloads()

  • Pingback: streaming movies()

  • Pingback: streaming movies()

  • Pingback: Blue Coaster33()

  • Eric Martin

    Where do I copy my existing Tomcat .jsp, and .html files in Maven?

  • Yogi

    If there is a tool to generate the dependency configuration unit?

  • dli7mar

    When the war file is ready, how do I deploy it to tomcat? how do I create the application folder under tomcat/webapps?

    • aaaa

      just put war there

  • Jaimoto


    Thanks for the tutorial, really helpful !

  • mostafa

    please tell me what is the problem ?
    the following is an exception when i run a war file in weblogic:

    Error 500–Internal Server Error
    org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [] for bean with name ‘MonitoringController’ defined in ServletContext resource [/WEB-INF/CSR-servlet.xml]; nested exception is java.lang.ClassNotFoundException: Class bytes found but defineClass()failed for: ‘’
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(
    at org.springframework.web.servlet.HttpServletBean.init(
    at javax.servlet.GenericServlet.init(
    at weblogic.servlet.internal.ServletStubImpl$
    at weblogic.servlet.internal.ServletStubImpl.createServlet(
    at weblogic.servlet.internal.ServletStubImpl.createInstances(
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(
    at weblogic.servlet.internal.ServletStubImpl.getServlet(
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(
    at weblogic.servlet.internal.WebAppServletContext$
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(
    at weblogic.servlet.internal.ServletRequestImpl.execute(
    at weblogic.kernel.ExecuteThread.execute(
    Caused by: java.lang.ClassNotFoundException: Class bytes found but defineClass()failed for: ‘’
    at weblogic.utils.classloaders.GenericClassLoader.findClass(
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(
    at java.lang.ClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(
    at org.springframework.util.ClassUtils.forName(
    … 27 more
    Caused by: java.lang.UnsupportedClassVersionError: ch/orange/pna/csr/web/MonitoringController (Unsupported major.minor version 50.0)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(
    at weblogic.utils.classloaders.GenericClassLoader.findClass(
    … 35 more

  • Amol Ghotankar


    Thanks for the post and I have been your fan and following you all time.

    I have a web project which is now grown a lot big and hence there is a need to convert it into maven and use the modules/trunk type architecture using which I can separate out the modules and keep then separately.

    Any guide to create the same? May be part-2 of this series?

    Problem is I have around 10 modules in the project and each module has set of dto’s, dao’s & services. Now I want to migrate to repository based maven structure which will hold these modules separately and jars will get added to my project.

    I hope I am clear.

  • swetha naik

    I have a already built maven project, now I want to add few more files to utilise their functionality. I tried to include those folders in the path required, but it shows error when I do a maven build. What are changes I need to do to add them, so that I can use them in the project.

  • Mark

    Cheers for the example, very good and easy to understand. I only have one problem though

    3. Configure the dependency libraries

    is there no way Maven or Eclipse or anything can’t import from you lib folder or lookup the dependencies based on the jar names in this folder? It’s just I have 63 jars, Hibernate Spring Apache-Common JSF and a load more and not all (most in fact) I can’t find the maven dependency groupId/artifactId.

    • mkyong

      I don’t know any tool that can automate the process, try search your jar in , if it’s not, then include your jar in local repository and add it into pom.xml manually.

      • Siva

        When i convert already existing web project and keep same project folder structure like the first image in this page and apply maven capability. Is there anyway I can achieve that….


      • Bharat


        I am a beginner to Maven. Can you plz share a dynamic maven web project build using struts 1.2 flow?


    • Fred Bricon

      There is such a tool now, check out JBoss Tools 4.0.0(-Beta) from You’ll be able to identify, select, adjust the scope, convert of your dependencies :

      A screencast showcasing this feature :

  • Pingback: Creating a quick maven war project | Nguni Phakela's Blog()

  • Pingback: Convert Java web project to Maven based project - Maven Tutorial()

  • Pingback: Maven Tutorials | Tutorials()

  • Pingback: Java bookmark links, Dec 2009 – Week 1 | bookmark-link()

  • Pingback: Tomcat deploy Maven project web.xml to a wrong folder in Eclipse | Maven()