List<LayoutFileSet> (TempFileFactory temp) { final File outputDir = temp.allocateTempFile("extractedDir"); expandTask.setProject(getProject()); expandTask.setSrc(new File(jarPath.replace('/', File.separatorChar))); File target = outputDir; if (!pathInJar.endsWith("/")) { pathInJar += "/"; } if (pathInJar.startsWith("/")) { pathInJar = pathInJar.substring(1); } if (pathInJar.length() > 0) { final PatternSet patternSet = new PatternSet(); patternSet.createInclude().setName(pathInJar + "**"); expandTask.addPatternset(patternSet); target = new File(outputDir, pathInJar.replace('/', File.separatorChar)); } expandTask.setDest(outputDir); expandTask.perform(); final LayoutFileSet fileSet = new LayoutFileSet(); fileSet.setDir(target); return Collections.singletonList(fileSet); }