code: public void generateArchetypes(String containerType, File baseDir, File outputDir, boolean clean, List<String> dirs) throws IOException {
          LOG.debug("Generating archetypes from {} to {}", baseDir.getCanonicalPath(), outputDir.getCanonicalPath());
          File[] files = baseDir.listFiles();
          if (files != null) {
              for (File file: files) {
                  if (file.isDirectory()) {
                      File projectDir = file;
                      File projectPom = new File(projectDir, "pom.xml");
                      if (projectPom.exists() && !skipImport(projectDir)) {
                          if (archetypeUtils.isValidProjectPom(projectPom)) {
                              String fileName = file.getName();
                              String archetypeDirName = fileName.replace("example", "archetype");
                              if (fileName.equals(archetypeDirName)) {
                                  archetypeDirName += "-archetype";
                              }
                              archetypeDirName = containerType + "-" + archetypeDirName;
  
                              File archetypeDir = new File(outputDir, archetypeDirName);
                              generateArchetype(projectDir, projectPom, archetypeDir, clean, dirs);
                          } else {
                              // lets iterate through the children
                              String childContainerType = file.getName();
                              if (Strings.isNotBlank(containerType)) {
                                  childContainerType = containerType + "-" + childContainerType;
                              }
                              generateArchetypes(childContainerType, file, outputDir, clean, dirs);
                          }
                      }
                  }
              }
          }
      }
docs: Iterates through all nested directories and generates archetypes for all found, non-pom Maven projects.
  
  @param baseDir a directory to look for projects which may be converted to Maven Archetypes
  @param outputDir target directory where Maven Archetype projects will be generated
  @param clean regenerate the archetypes (clean the archetype target dir)?
  @throws IOException