code: public static String getArtefactDirectory(String path) {
  
          if (path != null) {
              final Matcher matcher = RESOURCE_PATH_PATTERN.matcher(path);
              if (matcher.find()) {
                  return matcher.group(1);
              }
          }
          return null;
      }
docs: Takes a file path and returns the name of the folder under grails-app i.e:
  
  Input: /usr/joe/project/grails-app/domain/com/mystartup/Book.groovy
  Output: domain
  
  @param path The path
  @return The domain or null if not known