How to import the maven project in Eclipse?

By | October 24, 2020

This tutorial talks about How to import the maven project in Eclipse?

Below are the steps to import a maven project in Eclipse:

  1. In Eclipse select File -> Import…
  2. In the import window, expand Maven and then select Existing Maven Projects and click the Next button

3. Click on Browse then select the directory that contains the pom.xml file of the project that we want to import and click on Finish

Once Import is done, You can see the following Maven project in Eclipse:

Explanation of Above Maven Project Directory Structure:

src -> It is the directory that is the root directory of source code and test code.
main -> It is the directory is the root directory for source code related to the application itself, not test code.
java -> Directories under main and test contain the Java code for the application itself which is under main and the Java code for the tests which is under test.
test -> Itis the directory contains the test source code.
target -> This is the directory created by Maven which contains all the compiled classes, JAR files etc..

NOTE: When executing the mvn clean command, Maven would clean the target directory.

src/main/java – > contains java source code files under the package structure(com.kkjavatutorials)

src/main/test – > contains test java source code files under the package structure (com.kkjavatutorials)

That’s all about How to import the maven project in Eclipse?
If you have any feedback or suggestion please feel free to drop in below comment box.

Leave a Reply

Your email address will not be published. Required fields are marked *