@Override public void execute(DependencyResolveDetails dep) { ModuleVersionSelector requested = dep.getRequested(); final String version = requested.getVersion(); if (SrcVersion.isSrcVersion(version)) { final SrcdepsService srcdepsService = Wiring.getInjector().getInstance(SrcdepsService.class); srcdepsService.buildIfNecessary(requested.getGroup(), requested.getName(), version); } }
public DefaultResolutionStrategy copy() { DefaultResolutionStrategy out = new DefaultResolutionStrategy(cachePolicy.copy(), new LinkedHashSet<Action<? super DependencyResolveDetails>>(dependencyResolveRules)); if (conflictResolution instanceof StrictConflictResolution) { out.failOnVersionConflict(); } out.setForcedModules(getForcedModules()); return out; }
@Override public void execute(DependencyResolveDetails dependencyResolveDetails) { String group = dependencyResolveDetails.getTarget().getGroup(); String name = dependencyResolveDetails.getTarget().getName(); if (aetherPlugin.getVersionMap().containsKey(group) && aetherPlugin.getVersionMap().get(group).containsKey(name)) { if (dependencyResolveDetails.getRequested().getVersion().equals(dependencyResolveDetails.getTarget().getVersion())) { dependencyResolveDetails.useVersion(aetherPlugin.getVersionMap().get(group).get(name)); } } else { RepositorySystem system = setupRepositorySystem(); RepositorySystemSession session = setupSession(project, system); List<RemoteRepository> remoteRepositories = new ArrayList<>(); for (ArtifactRepository artifactRepository : project.getRepositories()) { if (artifactRepository instanceof MavenArtifactRepository) { MavenArtifactRepository mavenArtifactRepository = (MavenArtifactRepository) artifactRepository; remoteRepositories.add(new RemoteRepository.Builder(mavenArtifactRepository.getName(), "default", mavenArtifactRepository.getUrl().toString()).build()); } } Artifact artifact = new DefaultArtifact(dependencyResolveDetails.getTarget().getGroup() + ":" + dependencyResolveDetails.getTarget().getName() + ":" + dependencyResolveDetails.getTarget().getVersion()); CollectRequest collectRequest = new CollectRequest(); String scope; if (configuration.getName().contains("test")) { scope = JavaScopes.TEST; } else if (configuration.getName().contains("runtime")) { scope = JavaScopes.RUNTIME; } else if (configuration.getName().equals("providedCompile") || configuration.getName().equals("compileOnly")) { scope = JavaScopes.PROVIDED; } else scope = JavaScopes.COMPILE; collectRequest.setRoot(new Dependency(artifact, scope)); collectRequest.setRepositories(remoteRepositories); try { CollectResult collectResult = system.collectDependencies(session, collectRequest); processDependencyNode(collectResult.getRoot()); } catch (DependencyCollectionException e) { e.printStackTrace(); } } }
public ResolutionStrategy eachDependency(Action<? super DependencyResolveDetails> rule) { mutationValidator.validateMutation(STRATEGY); dependencySubstitutions.allWithDependencyResolveDetails(rule); return this; }
@Override public DependencySubstitutions allWithDependencyResolveDetails(Action<? super DependencyResolveDetails> rule) { addRule(new DependencyResolveDetailsWrapperAction(rule)); return this; }
public DependencyResolveDetailsWrapperAction(Action<? super DependencyResolveDetails> delegate) { this.delegate = delegate; }
public DefaultResolutionStrategy() { this(new DefaultCachePolicy(), new LinkedHashSet<Action<? super DependencyResolveDetails>>()); }
DefaultResolutionStrategy(DefaultCachePolicy cachePolicy, Set<Action<? super DependencyResolveDetails>> dependencyResolveRules) { this.cachePolicy = cachePolicy; this.dependencyResolveRules = dependencyResolveRules; }
public ResolutionStrategy eachDependency(Action<? super DependencyResolveDetails> rule) { dependencyResolveRules.add(rule); return this; }
DependencySubstitutions allWithDependencyResolveDetails(Action<? super DependencyResolveDetails> rule);