Creating a Maven Project with Command Line


Apache Maven is a software project management and build management tool for java framework.

Maven Pros:

  • Central repository to get dependencies
  • Maintaining common structure across the organization
  • Flexibility in integrating with CI tools
  • Plugins for Test framework execution

Steps to download Maven for Windows:

  • Download the Maven file using the below link. to download Maven for Windows

  • Click on the “apache-Maven-3.6.3-bin zip”, to download. Extract the file into the respective drive.
  • Set system environment variable.

Setting up the Environment Variable:

  • JAVA file to be set in the environment variable before setting up the Maven environment variable.
  • Open extracted Maven file and copy the file path.
  • All Control Panel Items > System > Advanced system settings > Environment Variables
  • Click on New -Follow the below screen shot.

Setting up the Environment Variable

  • Click OK.

Setting up Maven path:

  • Open extracted Maven file and copy the file path till bin folder.
  • All control panel items>system>Advanced system settings>Environment Variables>system variables.
  • Try to find the “Path” and click on it.
  • Follow the below screenshot

Setting up Maven path

  • In Edit System variable window, for the path variable add the value as ”;C:apache-Maven-3.6.3bin” ( Note: mention the separator if there are any existing path value in the variable while adding the Maven path.)
  • Click OK.

Steps to verify if the Maven path is correctly configured into system environment variables:

  • Go to command line type this comment”mvn –version”, you will get all the details about Maven.

Maven path

Understanding Maven terminologies:

  • Artifact: An artifact is a file, usually a JAR, that gets deployed to a Maven repository
  • GroupID: GroupId will identify your project uniquely across all projects.
  • Archetype: Generate a new project from archetype.

Creating Maven Project:

  • Command to create a Maven project.

Creating Maven Project Note

: -DgroupId=”yourProjectGroupId”


  • Click ‘Enter’ afterwards it will take some time to create your Maven project and it shows “Build success” that means your Maven project successfully created.
  • You can see your project following path”C:Users….”.

Maven integration with Eclipse:

  • Go to command line and switch your recently created Maven project folder and enter this command”mvn eclipse:eclipse”

Maven integration with Eclipse

  • Hit Enter afterwards it will show “Build success”. That means our Maven project is ready to import into eclipse.
  • Go to eclipse>file>import>Existing Maven project>Next>your Maven project path>Finish

Existing Maven project

  • Maven project is successfully imported into eclipse as below.

Leave a Reply

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