This tutorial will guide you on how to create web application using maven and netbeans .This will assume that you have already maven installed in your system. Click here on how to install maven on windows.
Click create new project. On the pop up dialog, select Maven in categories and Web Application in Projects column.
Click Next. Enter your desired Project Name. The artifact id and group id are predefined with values based on your project name. Continue by clicking next. On the Settings page, Choose the server that you will use eg tomcat or glassfish. Click Finish. Creating will include downloading necessary dependency to create the project.
Your project structure should look something similar below:
You will add your Java sources under Source Packages. Your Web contents including your web.xml can be found in Web Pages. And your pom.xml can be found in Project Files. Your pom.xml should be look something simlar below,
4.0.0 <groupId>com.mycompany</groupId> <artifactId>mavenweb</artifactId>1.0-SNAPSHOT war mavenweb ${project.build.directory}/endorsed <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> 7.0 provided <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> 3.1 1.7 1.7 <compilerArguments>${endorsed.dir} </compilerArguments><groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> 2.3 <failOnMissingWebXml>false</failOnMissingWebXml> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> 2.6 validate copy <outputDirectory>${endorsed.dir}</outputDirectory> true <artifactItems> <artifactItem> <groupId>javax <artifactId>javaee-endorsed-api7.0 jar </artifactItem> </artifactItems>
You have completed the tutorial on how to create web application using maven and netbeans. You might also be interested in creating web application with spring mvc framework in maven.