Maven archetypes are useful for many things, including creating a folder structure to start with, even if you aren’t planning to use maven as your build tool. See a list of available archetypes here.
The easiest way to create a maven project structure is to use the quickstart archetype. For example:
mvn archetype:generate -DgroupId=com.shaunabram -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
This creates
my-app |-- pom.xml `-- src |-- main | `-- java | `-- com | `-- shaunabram `-- test `-- java `-- com `-- shaunabram `-- AppTest.java
Note this doesn’t create the (src/main/) resources folder. This posting suggests creating your own custom archetype. Creating the folder manually isn’t too big a deal though.
If you’re creating a web app, a better alternative to the quickstart archetype is to use the webapp archectype.
mvn archetype:generate -DgroupId=com.shaunabram -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-webapp
This creates
my-webapp |-src |---main |-----resources |-----webapp |-------index.jsp |-------WEB-INF |---------web.xml |-pom.xml
More details on Maven’s standard-directory-layout.
Followup: I created a Maven archetype to create a new project with a layout that is essentially a combination of what you get with the standard maven archetypes of quickstart and webapp. See maven-archetype-quickweb.