JpsPackagingElement (String relativeOutputPath, JpsPackagingElement element) { relativeOutputPath = StringUtil.trimStart(relativeOutputPath, "/"); if (relativeOutputPath.length() == 0) { return element; } int slash = relativeOutputPath.indexOf('/'); if (slash == -1) slash = relativeOutputPath.length(); String rootName = relativeOutputPath.substring(0, slash); String pathTail = relativeOutputPath.substring(slash); final JpsDirectoryPackagingElement root = createDirectory(rootName); final JpsCompositePackagingElement last = getOrCreateDirectoryOrArchive(root, pathTail, true); last.addChild(element); return root; }