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

ADVERTISEMENT

Table of Contents

Introduction

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.

Summary

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.

Next Steps

If you're interested in learning more about the basics of Java, coding, and software development, check out our Coding Essentials Guidebook for Developers, where we cover the essential languages, concepts, and tools that you'll need to become a professional developer.

Thanks and happy coding! We hope you enjoyed this article. If you have any questions or comments, feel free to reach out to jacob@initialcommit.io.

Final Notes