artifactRequest.addRepository( repo );
public void download(File file) throws ExtensionException { ArtifactRequest artifactRequest = new ArtifactRequest(); artifactRequest.addRepository(this.repository.getRemoteRepository()); artifactRequest.setArtifact(new DefaultArtifact(this.mavenModel.getGroupId(), this.mavenModel.getArtifactId(), getType(), this.mavenModel.getVersion())); ArtifactResult artifactResult; try { artifactResult = this.repositorySystem.resolveArtifact(this.repository.getSession(), artifactRequest); } catch (ArtifactResolutionException e) { throw new ExtensionException("Failed to resolve artifact", e); } File aetherFile = artifactResult.getArtifact().getFile(); try { FileUtils.copyFile(aetherFile, file); } catch (IOException e) { new ExtensionException("Failed to copy file", e); } }