Source:
<code>private List<ArtifactResult> resolveDependencies(Dependency dependency, PomInformation pomInformation) throws RepositoryException { LOGGER.info("Resolving dependencies for {}", dependency); org.apache.maven.repository.internal.DefaultServiceLocator locator = new org.apache.maven.repository.internal.DefaultServiceLocator(); locator.addService(RepositoryConnectorFactory.class, WagonRepositoryConnectorFactory.class); locator.setServices(WagonProvider.class, new HttpWagonProvider()); RepositorySystem system = locator.getService(RepositorySystem.class); MavenRepositorySystemSession mvnRepository = new MavenRepositorySystemSession(); mvnRepository.setLocalRepositoryManager(system.newLocalRepositoryManager(new LocalRepository(System.getProperty("java.io.tmpdir") + "/repo"))); RemoteRepository remoteRepository = new RemoteRepository("central", "default", "<LINK_0>"); CollectRequest collectRequest = new CollectRequest(); <START> Dependency updatedDependency = dependency; <END> if (pomInformation != null) { String version = parseDependencyVersion(dependency, mvnRepository, system, remoteRepository, pomInformation); Artifact artifact = dependency.getArtifact(); artifact = artifact.setVersion(version); updatedDependency = dependency.setArtifact(artifact); if (pomInformation.getRepositories() != null) { for (RemoteRepository repository : pomInformation.getRepositories()) { collectRequest.addRepository(repository); } } } collectRequest.setRoot(updatedDependency); collectRequest.addRepository(remoteRepository); DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.classpathFilter(JavaScopes.RUNTIME)); try { LOGGER.debug("Sending dependency request"); return system.resolveDependencies(mvnRepository, dependencyRequest).getArtifactResults(); } catch (RuntimeException e) { LOGGER.error("Unable to resolve dependencies for {}", dependency.toString(), e); return Collections.emptyList(); } }</code><technical_language>Do need a separate variable instance</technical_language>

Target:
private List<ArtifactResult> resolveDependencies(Dependency dependency, PomInformation pomInformation) throws RepositoryException { LOGGER.info("Resolving dependencies for {}", dependency); org.apache.maven.repository.internal.DefaultServiceLocator locator = new org.apache.maven.repository.internal.DefaultServiceLocator(); locator.addService(RepositoryConnectorFactory.class, WagonRepositoryConnectorFactory.class); locator.setServices(WagonProvider.class, new HttpWagonProvider()); RepositorySystem system = locator.getService(RepositorySystem.class); MavenRepositorySystemSession mvnRepository = new MavenRepositorySystemSession(); mvnRepository.setLocalRepositoryManager(system.newLocalRepositoryManager(new LocalRepository(System.getProperty("java.io.tmpdir") + "/repo"))); RemoteRepository remoteRepository = new RemoteRepository("central", "default", "<LINK_0>"); CollectRequest collectRequest = new CollectRequest(); if (pomInformation != null) { String version = parseDependencyVersion(dependency, mvnRepository, system, remoteRepository, pomInformation); String groupId = parseDependencyGroupId(dependency, mvnRepository, system, remoteRepository, pomInformation); Artifact artifact = dependency.getArtifact(); Artifact updatedArtifact = new DefaultArtifact(groupId, artifact.getArtifactId(), artifact.getClassifier(), artifact.getExtension(), version); dependency = dependency.setArtifact(updatedArtifact); if (pomInformation.getRepositories() != null) { for (RemoteRepository repository : pomInformation.getRepositories()) { collectRequest.addRepository(repository); } } } collectRequest.setRoot(dependency); collectRequest.addRepository(remoteRepository); DependencyRequest dependencyRequest = new DependencyRequest(collectRequest, DependencyFilterUtils.classpathFilter(JavaScopes.RUNTIME)); try { LOGGER.debug("Sending dependency request"); return system.resolveDependencies(mvnRepository, dependencyRequest).getArtifactResults(); } catch (RuntimeException e) { LOGGER.error("Unable to resolve dependencies for {}", dependency.toString(), e); return Collections.emptyList(); } }