List of usage examples for org.apache.maven.project MavenProject getRemoteArtifactRepositories
public List<ArtifactRepository> getRemoteArtifactRepositories()
From source file:org.universAAL.maven.treebuilder.ExecutionListCreator.java
License:Apache License
/** * Creates execution list for given MavenProject. * //w ww . jav a 2 s .c om * @param mavenProject * @return * @throws MojoExecutionException * @throws MojoFailureException */ public List createArtifactExecutionList(final MavenProject mavenProject, final Set<String> separatedArtifactDepsOfRootMvnUrls, final boolean includeTestRuntimes) throws Exception { DependencyTreeBuilder treeBuilder = new DependencyTreeBuilder(artifactFactory, mavenProjectBuilder, localRepository, includeTestRuntimes); List<ArtifactRepository> finalRemoteRpositories = addMissingRepositories( mavenProject.getRemoteArtifactRepositories()); List<RootNode> rootNodes = treeBuilder.buildDependencyTree(localRepository, artifactFactory, artifactMetadataSource, new MavenProjectDescriptor(mavenProject, finalRemoteRpositories, true)); List<ResolutionNode> separatedArtifactDepsOfRoot = treeBuilder.getSeparatedArtifactDepsOfRoot(); for (ResolutionNode separatedRootDep : separatedArtifactDepsOfRoot) { Artifact artifact = separatedRootDep.getArtifact(); separatedArtifactDepsOfRootMvnUrls.add(String.format("mvn:%s/%s/%s", artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion())); } if (rootNodes.size() != 1) { throw new IllegalStateException("rootNodes.size() != 1"); } List<RootNode> realRootNodes = new ArrayList<RootNode>(); RootNode theRootNode = rootNodes.get(0); theRootNode.remoteRepositories = finalRemoteRpositories; realRootNodes.add(theRootNode); return processTreeIntoFlatList(realRootNodes, mavenProject.getArtifact()); }