Java EE web applications with the archetype plugin

If you want to start with a Java EE web application, you can simply use the maven-archetype-webapp archetype to generate the Maven project skeleton, shown as follows:

$ mvn archetype:generate -B 
                   -DgroupId=com.packt.samples  
                   -DartifactId=my-webapp 
                   -Dpackage=com.packt.samples.webapp 
                   -Dversion=1.0.0  
                   -DarchetypeGroupId=org.apache.maven.archetypes  
                   -DarchetypeArtifactId=maven-archetype-webapp 
                   -DarchetypeVersion=1.0

The preceding command will produce the following directory structure. One issue here is that it does not have the java directory just after src/main. If you want to add any Java code, you need to make sure that you first create an src/main/java directory and create your Java ...

Get Maven Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.