-2

I just want create a maven project with this structure:

enter image description here

How can I do this?

Pierre.Vriens
  • 2,117
  • 75
  • 29
  • 42
Gonzalo Fernandez
  • 75
  • 1
  • 1
  • 11
  • What is your IDE? Looks like IntelliJ. Then just create a Maven project. – Tunaki Apr 23 '16 at 15:13
  • If you're on Linux then you can create the directory structure using `cd /path/to/directories && find . -type d -exec mkdir -p -- /path/to/backup/{} \;` – user Apr 23 '16 at 15:40
  • Possible duplicate of [Creating a maven project](http://stackoverflow.com/questions/8138099/creating-a-maven-project) – pczeus Apr 23 '16 at 17:08
  • I know, what if I want my own directory structure? I mean, I want my project like this: src > main > java, src > main > resources and src > main > webapp. I think I am confused, just adding pom.xml to my project it becomes a good maven projects? Or need I configure other things? – Gonzalo Fernandez Apr 23 '16 at 20:42

1 Answers1

0

Use Maven's archetype plugin to create a skeleton project as follows:

mvn archetype:generate -B -DarchetypeGroupId=org.apache.maven.archetypes \
   -DarchetypeArtifactId=maven-archetype-quickstart        \
   -DarchetypeVersion=1.1                                  \
   -DgroupId=com.company                                   \
   -DartifactId=project                                    \
   -Dversion=1.0-SNAPSHOT                                  \
   -Dpackage=com.company.project
JJF
  • 2,681
  • 2
  • 18
  • 31
  • I know, what if I want my own directory structure? I mean, I want my project like this: src > main > java, src > main > resources and src > main > webapp. I think I am confused, just adding pom.xml to my project it becomes a good maven projects? Or need I configure other things? – Gonzalo Fernandez Apr 23 '16 at 20:41
  • Maven devotees would tell you you should stick with the convention and I agree. But if you really want to have your own directory structure you can look at this answer http://stackoverflow.com/questions/15333964/how-to-edit-the-directory-structure-in-maven which tells how to set your own source and other directory locations. Other people who use maven and look at your stuff will not like this :-) – JJF Apr 25 '16 at 21:52