Sunday, October 6, 2013

09 - Creating a Maven Project in Eclipse



We'll use the Eclipse plugin m2eclipse to download an archetype to create a project in Eclipse. We'll also run custom commands (goals) like running Jetty, all within Eclipse.
New->other->maven project->next->filter(webapp)->select j23ee 4 -> Group Id(org.yash.javajadhav) -> Artifact Id : mywebapp ->version : 1.0-SNAPShot->finish.
Open pom.xml and remove maven-complie-plugin plugin and jetty plugin
<build>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groudId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
                <scanIntervalSeconds>5</scanIntervalSeconds> -> It checks for every 5 sec either any change in jsp or class files.
</configuration>
</plugin>
</plugins>
</build>

Now right click on pom.xml -> run as -> maven package (it is equal to mvn package command)
Right click on pom.xml-> runas -> maven build… -> Goals : jetty run -> run
Open browser-> http://localhost:8080/mywebapp/

No comments:

Post a Comment