javamavenmaven-3

Maven: create directory structure from pom.xml


I have Maven a pom.xml file (copied from another project, and adapted), and I would like to generate the directory structure for a new project. Which command can do this?

Note that I found countless examples on the web, that explained how to use mvn archetype:create to create a pom.xml file and the directory structure, but I already have a pom.xml, and I would like to create the directories based on that, without specifying groupId, artifactId etc on the command line.

mvn archetype:create-from-project also seems to create a pom.xml based on another pom.xml (?) but I just want the directories. Thank you in advance!

EDIT: I am aware that this is not a "big problem" because I can create the directories manually :) I did it already many times, and I always felt that there must be a smarter way to do it...


Solution

  • Not to sound condescending, but:

    mkdir -p src/main/java
    mkdir -p src/main/resources
    mkdir -p src/test/java
    mkdir -p src/test/resources
    

    (or feel free to substitute different directories).

    I don't know of any maven command that will create this structure for you without creating a new pom file.