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