How to convert a maven project to a non-maven project in Eclipse

Eclipse doesn’t provide a direct way to convert a Maven web project to a non-maven structure. In this tutorial, we provide an easy 2-steps way to do this.

1- Generate war file

Suppose we have an existing maven web project with the following structure:

Maven web project

In order to convert the above project to a non-maven structure, the first thing to do is to generate a war file by:

Right-click project –> Run as –> Maven install

The war file is then generated inside the target folder.

Save the generated war file (MavenWeb.war) to the Desktop before moving to the next step.

2- Import war file to Eclipse

Select: File –> import –> WAR file. Then browse to MavenWeb.war and name the new project as NonMavenWeb.

Import War file in Eclipse

After you click finish, a standard dynamic web project named ‘NonMavenWeb’ is created like the following:

Non maven structure in eclipse

As you notice, the generated project holds exactly all files defined previously in the maven project including JAR files and static resources, however, it doesn’t generate the java source code.

Eclipse just creates empty java packages, now all you need to do is to just copy the source code from maven project to the non-maven one and you’re good to go.

 

Hussein Terek

Founder of programmergate.com, I have a passion in software engineering and everything related to java environment.

You may also like...

Leave a Reply

avatar