Tuesday, July 17, 2012

Maven, first web project 1

1. Run maven command below under a folder where you want to create you new project. Use your concrete groupId and artifactId to replace the blue part.

mvn archetype:generate -DgroupId=<groupId> -DartifactId=<artifactId> -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false



2.Now need to create several folders manually to let its struture conform to the maven standard directory layout. After that, you can find its folder struture as such:

websample
    +-src
        +-main
            +-java (Added manually)
            +-resources
            +-webapp
                +-WEB-INF
                    +-web.xml
                +-index.jsp
        +-test (Added manually)
            +-java
            +-resources
    +-pom.xml

3.Now this is web project can be imported into eclipse. Before you do this step you need to make sure there is a maven plugin installed in your eclipse. If there no, recommend m2e.


Now you can add your codes to this web project. In next segment I plan on practising how to integrate it with tomcat and making them become a complete development environment.

No comments:

Post a Comment