How to create an empty multi module Maven project?

后端 未结 8 440
孤独总比滥情好
孤独总比滥情好 2020-12-04 05:19

Right now I usually find a pom.xml file on the web that has a pom packaging and copy and paste it to create my parent project. Then I used to run <

8条回答
  •  無奈伤痛
    2020-12-04 05:49

    mvn archetype:create has been deprecated in favor of mvn archetype:generate, so just the name changed. There is an archetype for multi-module projects in the official repositories, so running this command yields the (minimalist) result:

    [axe@gromp test]$ mvn archetype:generate
    ..
    : remote -> pom-root (Root project archetype for creating multi module projects)
    ..
    Choose a number: 109: 
    .. 
    
    [axe@gromp test]$ tree 
    .
    └── modules.test
        └── pom.xml
    
    1 directory, 1 file
    
    [axe@gromp test]$ cat modules.test/pom.xml 
    
      4.0.0
      com.example
      modules.test
      1.0-SNAPSHOT
      pom
      modules.test
    
    

    So, basically you will have to create the folder structure and module descriptors (pom.xml files) yourself. Using a simple shell script or batch file will easily do this, if you require it more than once.

提交回复
热议问题