JarsTransformOutputProvider implements TransformOutputProvider { @Override public File getContentLocation( String name, Set<QualifiedContent.ContentType> types, Set<? super QualifiedContent.Scope> scopes, Format format) { if (format == Format.DIRECTORY) { return new File(System.getProperty("java.io.tmpdir")); } final File file; if (name.startsWith(inputFolder.getAbsolutePath())) { String[] nameParts = name.split(File.separator); LinkedList<String> baseFolderParts = new LinkedList(Arrays.asList(nameParts)); for (int i = 0; i < outputFolderParts.length; i++) { baseFolderParts.removeFirst(); } StringBuilder sb = new StringBuilder(); for (int i = 0; i < baseFolderParts.size(); i++) { sb.append(baseFolderParts.get(i)); if (i != baseFolderParts.size() - 1) { sb.append(File.separator); } } file = new File(outputFolder, sb.toString()); } else { if (!name.endsWith(".jar")) { name += ".jar"; } file = new File(outputFolder, name); } return file; } JarsTransformOutputProvider(File outputFolder, File inputFolder); @Override void deleteAll(); @Override File getContentLocation(
      String name,
      Set<QualifiedContent.ContentType> types,
      Set<? super QualifiedContent.Scope> scopes,
      Format format);  }
@Test public void getContentLocation() throws Exception { File output = provider.getContentLocation(inputJarFile.getAbsolutePath(), null, null, Format.JAR); assertThat(output.getAbsolutePath()).isEqualTo(outputJarFile.getAbsolutePath()); }