I. How to create project in MAVEN

There are two ways for create project in MAVEN

1. Normal Java Project

  • Step 1:
    • cmd
    • past below code to command prompt
mvn archetype:generate -DgroupId=com.javacambodia -DartifactId=NumberGenerator -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
  • Note:
    • DgroupId : name of your package (whatever you want)
    • DartifactId : name of your project
    • Press enter
  • Step 2: Import project to eclipse
    • Go to eclipse IDE
    • File (menu) > Import
    • Maven > Existing Maven Projects
    • Click Next
    • Browse…
    • You will see the project structure on the “Project Explorer”
    • Find your project location on your computer
    • Click OK
    • Click Finish
  • Step 3:
    • To Run the project
    • Right click on the java main class
    • Run As –> Java Application

You will see the result

2. Spring MVC Project Example

  • Step 1:
    •  cmd
    • past below code to command prompt
      mvn archetype:generate -DarchetypeGroupId=pl.codeleak -DarchetypeArtifactId=spring-mvc-quickstart -DarchetypeVersion=5.0.0 -DgroupId=com.sysome -DartifactId=ArticleSolution -Dversion=1.0 -DarchetypeRepository=http://kolorobot.github.io/spring-mvc-quickstart-archetype
    • Press Enter
  • Step 2: Import project to eclipse
    • Do the same things on the above page.
    • We will see the project structure as below
  • Step 3: Run the project
    • Run As
    • Run on the server
    • Wait until the server initialize
    • The result will show as below
    • You can copy url and past to your browser (firefox, chrome, ……)
      • Home page
      • About page
      • Sign in page
      • Signup page
      • Or

Published by sysomeho

Ho Sysome obtains B.S. degree in Computer Science from Phnom Penh Internation University (PPIU) in 2013 and currently studying Master of Science in IT (MSIT) at Asia Euro University (AEU). He worked as an IT Officer at Microfinance Institute and Bank in Phnom Penh. He is familar in programming language such as VB.NET, Java (Java2EE, Spring), Codeigniter, Laravel, mysql, sql server and so on. He enjoys sharing knowledges, learns from other, and develop himself. Find him on Facebook: Spy Ro, Linkedin: Sysome HO.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.