Experience in first simple maven project
Last week (21st April 2012) Yarl IT Hub had conducted an online meeting about Java web programming techniques and fundamentals,
followed by a session on Git source control, Maven build and initial
project setup for crash course series. That day I heard about the Maven.
Set up the maven
I did the following set up to run the maven project.
- Install jdk 1.7 and set the class path.
- Install netbeans 7.1 with server (Tomcat 7.0.22).
- Install maven and set the class path.
- Add maven plugin to netbeans. go through this instructions.
- Open the command prompt and run command "mvn --version" to checked is the maven correctly installed or not.
| If the maven installed correctly, the command prompt look like this. |
Create the first project.
- In the commend prompt I typed "mvn archetype:generate -DarchetypeArtifactId=mavenarchetype-webapp -DgroupId=org.yarlithub.yschool -DartifactId=yschool"
- It run long time. finally It displayed the message "BUILD SUCCESS".
- Then I changed my directory, where my project is created (yschool).
- then I compiled my project by "mvn compile" command.
- After I compiled, a folder 'target' was created into the yschool folder.
- Then I add a jetty plugin to maven pom.xml
- Run the command "mvn install jetty:run", It also run long time, finally it displayed the message "[INFO] Started Jetty Server"
- Then I started my browser and type "http://localhost:8080/yschool/", the browser displayed "Hello World".
- Then I go through yschool --->src ---> main ---> webapp --->index.jsp and edit text and reload the browser.
This is my first maven project.
Good Blog Niroshan.. This is what I was looking for.
ReplyDeleteCan you explain what happens when you run "mvn install jetty:run"? I mean how does it compile and run the system? Try to study how maven works. That will help you working around maven in future.