public void extractArtifact(Coordinate artifactCoords, File targetDir) throws IOException, DependencyException { final DependencyQueryBuilder query = DependencyQueryBuilder.create(artifactCoords); Dependency dependency = depsResolver.resolveArtifact(query); FileResource<?> artifact = dependency.getArtifact(); ZipUtil.unzipToFolder(new File(artifact.getFullyQualifiedName()), targetDir); }
// @formatter:off @Override public Configuration getConfiguration(GraphContext context) { return ConfigurationBuilder.begin() .addRule() .when(Query.find(FileModel.class).withProperty(FileModel.IS_DIRECTORY, true)) .perform( Iteration.over(FileModel.class) .perform(new RecurseDirectoryAndAddFiles()) .endIteration()) .addRule() .when( Query.find(FileModel.class) .withProperty(FileModel.IS_DIRECTORY, false) .withProperty( FileModel.FILE_PATH, QueryPropertyComparisonType.REGEX, ZipUtil.getEndsWithZipRegularExpression())) .perform(Iteration.over().perform(new AddArchiveReferenceInformation()).endIteration()); }