List of usage examples for org.apache.maven.project MavenProject createArtifacts
@Deprecated public Set<Artifact> createArtifacts(ArtifactFactory artifactFactory, String inheritedScope, ArtifactFilter filter) throws InvalidDependencyVersionException
From source file:org.jboss.maven.shared.release.phase.MapVersionRangesPhase.java
License:Open Source License
private void checkProject(final MavenProject project, final Map<String, String> originalVersions, final ReleaseDescriptor releaseDescriptor) throws ReleaseExecutionException { Map<String, Artifact> artifactMap = ArtifactUtils.artifactMapByVersionlessId(project.getArtifacts()); try {/* ww w . j a v a 2s.co m*/ Set<Artifact> dependencyArtifacts = project.createArtifacts(artifactFactory, null, null); checkDependencies(project, originalVersions, releaseDescriptor, artifactMap, dependencyArtifacts); } catch (InvalidDependencyVersionException e) { throw new ReleaseExecutionException("Failed to create dependency artifacts", e); } }
From source file:org.jetbrains.idea.maven.server.Maven30ServerEmbedderImpl.java
License:Apache License
@Nonnull public MavenExecutionResult doResolveProject(@Nonnull final File file, @Nonnull final List<String> activeProfiles, @Nonnull final List<String> inactiveProfiles, final List<ResolutionListener> listeners) throws RemoteException { final MavenExecutionRequest request = createRequest(file, activeProfiles, inactiveProfiles, Collections.<String>emptyList()); request.setUpdateSnapshots(myAlwaysUpdateSnapshots); final AtomicReference<MavenExecutionResult> ref = new AtomicReference<MavenExecutionResult>(); executeWithMavenSession(request, new Runnable() { @Override// w ww.ja v a 2s .c o m public void run() { try { // copied from DefaultMavenProjectBuilder.buildWithDependencies ProjectBuilder builder = getComponent(ProjectBuilder.class); CustomMaven3ModelInterpolator2 modelInterpolator = (CustomMaven3ModelInterpolator2) getComponent( ModelInterpolator.class); String savedLocalRepository = modelInterpolator.getLocalRepository(); modelInterpolator.setLocalRepository(request.getLocalRepositoryPath().getAbsolutePath()); List<ProjectBuildingResult> results; try { // Don't use build(File projectFile, ProjectBuildingRequest request) , because it don't use cache !!!!!!!! (see http://devnet.jetbrains.com/message/5500218) results = builder.build(Collections.singletonList(new File(file.getPath())), false, request.getProjectBuildingRequest()); } finally { modelInterpolator.setLocalRepository(savedLocalRepository); } ProjectBuildingResult buildingResult = results.get(0); MavenProject project = buildingResult.getProject(); RepositorySystemSession repositorySession = getComponent(LegacySupport.class) .getRepositorySession(); if (repositorySession instanceof DefaultRepositorySystemSession) { ((DefaultRepositorySystemSession) repositorySession) .setTransferListener(new Maven30TransferListenerAdapter(myCurrentIndicator)); if (myWorkspaceMap != null) { ((DefaultRepositorySystemSession) repositorySession) .setWorkspaceReader(new Maven30WorkspaceReader(myWorkspaceMap)); } } List<Exception> exceptions = new ArrayList<Exception>(); loadExtensions(project, exceptions); //Artifact projectArtifact = project.getArtifact(); //Map managedVersions = project.getManagedVersionMap(); //ArtifactMetadataSource metadataSource = getComponent(ArtifactMetadataSource.class); project.setDependencyArtifacts( project.createArtifacts(getComponent(ArtifactFactory.class), null, null)); // if (USE_MVN2_COMPATIBLE_DEPENDENCY_RESOLVING) { ArtifactResolutionRequest resolutionRequest = new ArtifactResolutionRequest(); resolutionRequest.setArtifactDependencies(project.getDependencyArtifacts()); resolutionRequest.setArtifact(project.getArtifact()); resolutionRequest.setManagedVersionMap(project.getManagedVersionMap()); resolutionRequest.setLocalRepository(myLocalRepository); resolutionRequest.setRemoteRepositories(project.getRemoteArtifactRepositories()); resolutionRequest.setListeners(listeners); resolutionRequest.setResolveRoot(false); resolutionRequest.setResolveTransitively(true); ArtifactResolver resolver = getComponent(ArtifactResolver.class); ArtifactResolutionResult result = resolver.resolve(resolutionRequest); project.setArtifacts(result.getArtifacts()); // end copied from DefaultMavenProjectBuilder.buildWithDependencies ref.set(new MavenExecutionResult(project, exceptions)); } else { final DependencyResolutionResult dependencyResolutionResult = resolveDependencies(project, repositorySession); final List<Dependency> dependencies = dependencyResolutionResult.getDependencies(); Set<Artifact> artifacts = new LinkedHashSet<Artifact>(dependencies.size()); for (Dependency dependency : dependencies) { final Artifact artifact = RepositoryUtils.toArtifact(dependency.getArtifact()); artifact.setScope(dependency.getScope()); artifact.setOptional(dependency.isOptional()); artifacts.add(artifact); resolveAsModule(artifact); } project.setArtifacts(artifacts); ref.set(new MavenExecutionResult(project, dependencyResolutionResult, exceptions)); } } catch (Exception e) { ref.set(handleException(e)); } } }); return ref.get(); }
From source file:org.jetbrains.idea.maven.server.Maven32ServerEmbedderImpl.java
License:Apache License
@Nonnull public MavenExecutionResult doResolveProject(@Nonnull final File file, @Nonnull final List<String> activeProfiles, @Nonnull final List<String> inactiveProfiles, final List<ResolutionListener> listeners) throws RemoteException { final MavenExecutionRequest request = createRequest(file, activeProfiles, inactiveProfiles, Collections.<String>emptyList()); request.setUpdateSnapshots(myAlwaysUpdateSnapshots); final AtomicReference<MavenExecutionResult> ref = new AtomicReference<MavenExecutionResult>(); executeWithMavenSession(request, new Runnable() { @Override/* ww w . j ava 2 s . co m*/ public void run() { try { // copied from DefaultMavenProjectBuilder.buildWithDependencies ProjectBuilder builder = getComponent(ProjectBuilder.class); CustomMaven3ModelInterpolator2 modelInterpolator = (CustomMaven3ModelInterpolator2) getComponent( ModelInterpolator.class); String savedLocalRepository = modelInterpolator.getLocalRepository(); modelInterpolator.setLocalRepository(request.getLocalRepositoryPath().getAbsolutePath()); List<ProjectBuildingResult> results; try { // Don't use build(File projectFile, ProjectBuildingRequest request) , because it don't use cache !!!!!!!! (see http://devnet.jetbrains.com/message/5500218) results = builder.build(Collections.singletonList(new File(file.getPath())), false, request.getProjectBuildingRequest()); } finally { modelInterpolator.setLocalRepository(savedLocalRepository); } ProjectBuildingResult buildingResult = results.get(0); MavenProject project = buildingResult.getProject(); RepositorySystemSession repositorySession = getComponent(LegacySupport.class) .getRepositorySession(); if (repositorySession instanceof DefaultRepositorySystemSession) { ((DefaultRepositorySystemSession) repositorySession) .setTransferListener(new TransferListenerAdapter(myCurrentIndicator)); if (myWorkspaceMap != null) { ((DefaultRepositorySystemSession) repositorySession) .setWorkspaceReader(new Maven32WorkspaceReader(myWorkspaceMap)); } } List<Exception> exceptions = new ArrayList<Exception>(); loadExtensions(project, exceptions); //Artifact projectArtifact = project.getArtifact(); //Map managedVersions = project.getManagedVersionMap(); //ArtifactMetadataSource metadataSource = getComponent(ArtifactMetadataSource.class); project.setDependencyArtifacts( project.createArtifacts(getComponent(ArtifactFactory.class), null, null)); // if (USE_MVN2_COMPATIBLE_DEPENDENCY_RESOLVING) { ArtifactResolutionRequest resolutionRequest = new ArtifactResolutionRequest(); resolutionRequest.setArtifactDependencies(project.getDependencyArtifacts()); resolutionRequest.setArtifact(project.getArtifact()); resolutionRequest.setManagedVersionMap(project.getManagedVersionMap()); resolutionRequest.setLocalRepository(myLocalRepository); resolutionRequest.setRemoteRepositories(project.getRemoteArtifactRepositories()); resolutionRequest.setListeners(listeners); resolutionRequest.setResolveRoot(false); resolutionRequest.setResolveTransitively(true); ArtifactResolver resolver = getComponent(ArtifactResolver.class); ArtifactResolutionResult result = resolver.resolve(resolutionRequest); project.setArtifacts(result.getArtifacts()); // end copied from DefaultMavenProjectBuilder.buildWithDependencies ref.set(new MavenExecutionResult(project, exceptions)); } else { final DependencyResolutionResult dependencyResolutionResult = resolveDependencies(project, repositorySession); final List<Dependency> dependencies = dependencyResolutionResult.getDependencies(); Set<Artifact> artifacts = new LinkedHashSet<Artifact>(dependencies.size()); for (Dependency dependency : dependencies) { final Artifact artifact = RepositoryUtils.toArtifact(dependency.getArtifact()); artifact.setScope(dependency.getScope()); artifact.setOptional(dependency.isOptional()); artifacts.add(artifact); resolveAsModule(artifact); } project.setArtifacts(artifacts); ref.set(new MavenExecutionResult(project, dependencyResolutionResult, exceptions)); } } catch (Exception e) { ref.set(handleException(e)); } } }); return ref.get(); }
From source file:org.jetbrains.maven.embedder.MavenEmbedder.java
License:Apache License
@Nonnull public MavenExecutionResult resolveProject(@Nonnull final File file, @Nonnull final List<String> activeProfiles, @Nonnull final List<String> inactiveProfiles, List<ResolutionListener> listeners) { MavenExecutionRequest request = createRequest(file, activeProfiles, inactiveProfiles, Collections.<String>emptyList()); ProjectBuilderConfiguration config = request.getProjectBuilderConfiguration(); request.getGlobalProfileManager().loadSettingsProfiles(mySettings); ProfileManager globalProfileManager = request.getGlobalProfileManager(); globalProfileManager.loadSettingsProfiles(request.getSettings()); List<Exception> exceptions = new ArrayList<Exception>(); MavenProject project = null; try {// w w w .j a v a 2 s . c o m // copied from DefaultMavenProjectBuilder.buildWithDependencies MavenProjectBuilder builder = getComponent(MavenProjectBuilder.class); project = builder.build(new File(file.getPath()), config); builder.calculateConcreteState(project, config, false); // copied from DefaultLifecycleExecutor.execute findExtensions(project); // end copied from DefaultLifecycleExecutor.execute Artifact projectArtifact = project.getArtifact(); Map managedVersions = project.getManagedVersionMap(); ArtifactMetadataSource metadataSource = getComponent(ArtifactMetadataSource.class); project.setDependencyArtifacts( project.createArtifacts(getComponent(ArtifactFactory.class), null, null)); ArtifactResolver resolver = getComponent(ArtifactResolver.class); ArtifactResolutionResult result = resolver.resolveTransitively(project.getDependencyArtifacts(), projectArtifact, managedVersions, myLocalRepository, project.getRemoteArtifactRepositories(), metadataSource, null, listeners); project.setArtifacts(result.getArtifacts()); // end copied from DefaultMavenProjectBuilder.buildWithDependencies } catch (Exception e) { return handleException(e); } return new MavenExecutionResult(project, exceptions); }
From source file:org.mobicents.maven.plugin.eclipse.ClasspathWriter.java
License:Open Source License
/** * Writes the .classpath file for eclipse. * /*w ww . j a va2 s. c om*/ * @param projects * the list of projects from which the .classpath will get its * dependencies. * @param repositoryVariableName * the name of the maven repository variable. * @param artifactFactory * the factory for constructing artifacts. * @param artifactResolver * the artifact resolver. * @param localRepository * the local repository instance. * @param artifactMetadataSource * @param classpathArtifactTypes * the artifacts types that are allowed in the classpath file. * @param remoteRepositories * the list of remote repository instances. * @param resolveTransitiveDependencies * whether or not dependencies shall be transitively resolved. * @param merge * anything extra (not auto-generated), that should be "merged" * into the generated .classpath * @param classpathExcludes * @param includeTestsDirectory * @param includeResourcesDirectory * @throws Exception */ public void write(final List projects, final String repositoryVariableName, final ArtifactFactory artifactFactory, final ArtifactResolver artifactResolver, final ArtifactRepository localRepository, final ArtifactMetadataSource artifactMetadataSource, final Set classpathArtifactTypes, final List remoteRepositories, final boolean resolveTransitiveDependencies, final String merge, Set classpathExcludes, boolean includeResourcesDirectory) throws Exception { final String rootDirectory = PathNormalizer.normalizePath(this.project.getBasedir().toString()); final File classpathFile = new File(rootDirectory, ".classpath"); final FileWriter fileWriter = new FileWriter(classpathFile); final XMLWriter writer = new PrettyPrintXMLWriter(fileWriter, "UTF-8", null); writer.startElement("classpath"); final Set projectArtifactIds = new LinkedHashSet(); for (final Iterator iterator = projects.iterator(); iterator.hasNext();) { final MavenProject project = (MavenProject) iterator.next(); final Artifact projectArtifact = artifactFactory.createArtifact(project.getGroupId(), project.getArtifactId(), project.getVersion(), null, project.getPackaging()); projectArtifactIds.add(projectArtifact.getId()); } // - collect the source roots for the root project (if they are any) Set<String> sourceRoots = collectSourceRoots(this.project, rootDirectory, writer, includeResourcesDirectory); final Set allArtifacts = new LinkedHashSet(this.project.createArtifacts(artifactFactory, null, null)); for (final Iterator iterator = projects.iterator(); iterator.hasNext();) { final MavenProject project = (MavenProject) iterator.next(); sourceRoots.addAll(collectSourceRoots(project, rootDirectory, writer, includeResourcesDirectory)); final Set artifacts = project.createArtifacts(artifactFactory, null, null); // - get the direct dependencies for (final Iterator artifactIterator = artifacts.iterator(); artifactIterator.hasNext();) { final Artifact artifact = (Artifact) artifactIterator.next(); // - don't attempt to resolve the artifact if its part of the // project (we // infer this if it has the same id has one of the projects or // is in // the same groupId). if (!projectArtifactIds.contains(artifact.getId()) && !project.getGroupId().equals(artifact.getGroupId())) { artifactResolver.resolve(artifact, project.getRemoteArtifactRepositories(), localRepository); allArtifacts.add(artifact); } else { allArtifacts.add(artifact); } } } // we have all source roots now, sort and write for (String sourceRoot : sourceRoots) { logger.info("Adding src path " + sourceRoot); this.writeClasspathEntry(writer, "src", sourceRoot); } // - remove the project artifacts for (final Iterator iterator = projects.iterator(); iterator.hasNext();) { final MavenProject project = (MavenProject) iterator.next(); final Artifact projectArtifact = project.getArtifact(); if (projectArtifact != null) { for (final Iterator artifactIterator = allArtifacts.iterator(); artifactIterator.hasNext();) { final Artifact artifact = (Artifact) artifactIterator.next(); final String projectId = projectArtifact.getArtifactId(); final String projectGroupId = projectArtifact.getGroupId(); final String artifactId = artifact.getArtifactId(); final String groupId = artifact.getGroupId(); if (artifactId.equals(projectId) && groupId.equals(projectGroupId)) { artifactIterator.remove(); } } } } // - now we resolve transitively, if we have the flag on if (resolveTransitiveDependencies) { final Artifact rootProjectArtifact = artifactFactory.createArtifact(this.project.getGroupId(), this.project.getArtifactId(), this.project.getVersion(), null, this.project.getPackaging()); final OrArtifactFilter filter = new OrArtifactFilter(); filter.add(new ScopeArtifactFilter(Artifact.SCOPE_COMPILE)); filter.add(new ScopeArtifactFilter(Artifact.SCOPE_PROVIDED)); filter.add(new ScopeArtifactFilter(Artifact.SCOPE_TEST)); final ArtifactResolutionResult result = artifactResolver.resolveTransitively(allArtifacts, rootProjectArtifact, localRepository, remoteRepositories, artifactMetadataSource, filter); allArtifacts.clear(); allArtifacts.addAll(result.getArtifacts()); } // remove excluded ones for (Iterator i = allArtifacts.iterator(); i.hasNext();) { Artifact artifact = (Artifact) i.next(); if (classpathExcludes != null) { if (classpathExcludes.contains(artifact.getGroupId())) { logger.info("Excluding " + artifact + " from .classpath, groupId is excluded"); i.remove(); } else if (classpathExcludes.contains(artifact.getGroupId() + ":" + artifact.getArtifactId())) { logger.info("Excluding " + artifact + " from .classpath, groupId:artifactId is excluded"); i.remove(); } else if (classpathExcludes.contains( artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion())) { logger.info( "Excluding " + artifact + " from .classpath, groupId:artifactId:version is excluded"); i.remove(); } } } final List allArtifactPaths = new ArrayList(allArtifacts); for (final ListIterator iterator = allArtifactPaths.listIterator(); iterator.hasNext();) { final Artifact artifact = (Artifact) iterator.next(); if (classpathArtifactTypes.contains(artifact.getType())) { File artifactFile = artifact.getFile(); if (artifactFile == null) { artifactResolver.resolve(artifact, project.getRemoteArtifactRepositories(), localRepository); artifactFile = artifact.getFile(); } if (artifactFile != null) { final String path = StringUtils.replace(PathNormalizer.normalizePath(artifactFile.toString()), PathNormalizer.normalizePath(localRepository.getBasedir()), repositoryVariableName); iterator.set(path); } else { iterator.remove(); } } else { iterator.remove(); } } // - sort the paths Collections.sort(allArtifactPaths); for (final Iterator iterator = allArtifactPaths.iterator(); iterator.hasNext();) { String path = (String) iterator.next(); if (path.startsWith(repositoryVariableName)) { this.writeClasspathEntry(writer, "var", path); } else { if (path.startsWith(rootDirectory)) { path = StringUtils.replace(path, rootDirectory + '/', ""); } this.writeClasspathEntry(writer, "lib", path); } } this.writeClasspathEntry(writer, "con", "org.eclipse.jdt.launching.JRE_CONTAINER"); String outputPath = StringUtils.replace( PathNormalizer.normalizePath(this.project.getBuild().getOutputDirectory()), rootDirectory, ""); if (outputPath.startsWith("/")) { outputPath = outputPath.substring(1, outputPath.length()); } this.writeClasspathEntry(writer, "output", outputPath); if (StringUtils.isNotBlank(merge)) { writer.writeMarkup(merge); } writer.endElement(); logger.info("Classpath file written --> '" + classpathFile + "'"); IOUtil.close(fileWriter); }
From source file:org.nuxeo.build.maven.EmbeddedMavenClient.java
License:Open Source License
public void resolveDependencyTree(Artifact artifact, ArtifactFilter filter, ResolutionListener listener) throws ArtifactResolutionException, ProjectBuildingException { MavenProject project = mavenProjectBuilder.buildFromRepository(artifact, getRemoteRepositories(), localRepository);//from www . ja va 2 s . c o m @SuppressWarnings("rawtypes") Set dependencyArtifacts = project.getDependencyArtifacts(); if (dependencyArtifacts == null) { try { dependencyArtifacts = project.createArtifacts(artifactFactory, null, null); } catch (InvalidDependencyVersionException e) { throw new ArtifactResolutionException("Cannot set dependencies", artifact, e); } project.setDependencyArtifacts(dependencyArtifacts); } ArtifactCollector collector = new DefaultArtifactCollector(); collector.collect(dependencyArtifacts, project.getArtifact(), project.getManagedVersionMap(), localRepository, project.getRemoteArtifactRepositories(), artifactMetadataSource, filter, Collections.singletonList(listener)); }
From source file:org.ops4j.pax.construct.archetype.OSGiWrapperArchetypeMojo.java
License:Apache License
/** * Attempt to wrap direct dependencies of the wrapped artifact - in turn they will call this method, and so on... * //w w w. j a v a2 s . com * @param pom Maven project model */ private void wrapDirectDependencies(Pom pom) { /* * Use a local list to capture dependencies that are type POM, ie. collections of dependencies. These POM * artifacts don't require wrapping, so we must store and process them locally in the following loop... */ List dependencyPoms = new ArrayList(); // use the wrapped artifact's POM to kick things off dependencyPoms.add(getFactory().createProjectArtifact(groupId, artifactId, version)); while (!dependencyPoms.isEmpty()) { Artifact pomArtifact = (Artifact) dependencyPoms.remove(0); try { // Standard Maven code to get direct dependencies for a given POM MavenProject p = m_projectBuilder.buildFromRepository(pomArtifact, getRemoteRepos(), getLocalRepo()); Set artifacts = p.createArtifacts(getFactory(), null, null); // look for new artifacts to wrap dependencyPoms.addAll(processDependencies(pom, artifacts)); } catch (ProjectBuildingException e) { getLog().warn(e); } catch (InvalidDependencyVersionException e) { getLog().warn(e); } } }
From source file:org.ops4j.pax.construct.project.ImportBundleMojo.java
License:Apache License
/** * Search direct dependencies for more import candidates * // w w w. jav a 2 s . c o m * @param project the Maven project being imported */ private void processDependencies(MavenProject project) { try { /* * exclude common OSGi system bundles, as they don't need to be imported or provisioned */ Set artifacts = project.createArtifacts(m_factory, null, new ExcludeSystemBundlesFilter()); for (Iterator i = artifacts.iterator(); i.hasNext();) { Artifact artifact = (Artifact) i.next(); String candidateId = getCandidateId(artifact); String scope = artifact.getScope(); scope = adjustDependencyScope(scope); if (!importOptional && artifact.isOptional()) { getLog().info("Skipping optional dependency " + artifact); } else if (Artifact.SCOPE_PROVIDED.equals(scope)) { scheduleCandidate(candidateId); } else { getLog().info("Skipping dependency " + artifact); } } } catch (InvalidDependencyVersionException e) { getLog().warn("Problem resolving dependencies for " + project.getId()); } }
From source file:org.sonatype.flexmojos.compiler.AbstractCompilerMojo.java
License:Apache License
@SuppressWarnings("unchecked") private Map<Artifact, List<Artifact>> getDependencies(List<Artifact> rslArtifacts) throws MojoExecutionException { Map<Artifact, List<Artifact>> dependencies = new HashMap<Artifact, List<Artifact>>(); for (Artifact pomArtifact : rslArtifacts) { try {//from ww w. ja v a 2 s . c o m MavenProject pomProject = mavenProjectBuilder.buildFromRepository(pomArtifact, remoteRepositories, localRepository); Set pomArtifacts = pomProject.createArtifacts(artifactFactory, null, null); ArtifactResolutionResult arr = resolver.resolveTransitively(pomArtifacts, pomArtifact, remoteRepositories, localRepository, artifactMetadataSource); List<Artifact> artifactDependencies = new ArrayList<Artifact>(arr.getArtifacts()); artifactDependencies = removeNonRSLDependencies(rslArtifacts, artifactDependencies); dependencies.put(pomArtifact, artifactDependencies); } catch (Exception e) { throw new MojoExecutionException(e.getMessage(), e); } } return dependencies; }
From source file:org.sonatype.flexmojos.utilities.MavenUtils.java
License:Apache License
/** * Get dependency artifacts for a project using the local and remote repositories to resolve the artifacts * /* w ww . ja v a 2 s. c o m*/ * @param project maven project * @param resolver artifact resolver * @param localRepository artifact repository * @param remoteRepositories List of remote repositories * @param artifactMetadataSource artifactMetadataSource * @param artifactFactory TODO * @return all dependencies from the project * @throws MojoExecutionException thrown if an exception occured during artifact resolving */ @SuppressWarnings("unchecked") public static Set<Artifact> getDependencyArtifacts(MavenProject project, ArtifactResolver resolver, ArtifactRepository localRepository, List remoteRepositories, ArtifactMetadataSource artifactMetadataSource, ArtifactFactory artifactFactory) throws MojoExecutionException { Set<Artifact> artifacts = project.getDependencyArtifacts(); if (artifacts == null) { try { artifacts = project.createArtifacts(artifactFactory, null, null); } catch (InvalidDependencyVersionException e) { throw new MojoExecutionException(e.getMessage(), e); } project.setDependencyArtifacts(artifacts); } ArtifactResolutionResult arr; try { arr = resolver.resolveTransitively(project.getDependencyArtifacts(), project.getArtifact(), remoteRepositories, localRepository, artifactMetadataSource); } catch (AbstractArtifactResolutionException e) { throw new MojoExecutionException(e.getMessage(), e); } Set<Artifact> result = arr.getArtifacts(); // ## 6/18/09 StoneRiver Change to resolve RELEASE Artifact version ## for (Artifact artifact : result) { if (artifact.getVersion().equals(Artifact.RELEASE_VERSION)) { getReleaseVersion(artifact, localRepository, remoteRepositories, artifactMetadataSource); } } return result; }