Saturday, 18 February 2017

Create Maven Project for Framework & converting into eclipse project

How to create a maven project through command line?

Prerequisites:
The system should be configured with mvn, eclipse & JDK.

Let's start creating the Maven project through command line. Please follow the steps below to create a maven project & converting the maven project into an eclipse project.


Maven uses archetype plugin to create a simple Java Project. Let's Open the command prompt & navigate to the work-space directory. In the below example, I am creating a project under "F:\Workspace" directory. To create a project execute the command mvn archetype:generate

Define value for property 'groupId': com.demo.pom
Define value for property 'artifactId': POM_Demo

package: com.demo.pom
 Y: : Y

If you sees "BUILD SUCCESS" message, that means the project is created successfully. You can verify by navigating to "F:\Workspace" directory. In the above directory there should be a folder created in the name "POM_Demo".

Convert the mvn project into an Eclipse Project:
  1. In command prompt navigate to project folder. Use the command below: "cd POM_Demo".
  2. Use command "mvn eclipse:eclipse". This will take some time to download the files & after successfully download it should show the "BUILD SUCCESS" message as beow.
In the above steps, we have created a mvn project. Now to use the mvn project in eclipse we need to convert the project into an eclipse project. To convert the the project into eclipse project follow the steps below:

      3. Now compile the project by using the command "mvn compile"

Now the project is ready for an eclipse project. So we can import the project into eclipse work-space & can create the required class files for the project. 



<<<Prev       Next>>>

No comments:

Post a Comment