1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.project.artifact;
20
21 import java.io.File;
22 import java.util.ArrayList;
23 import java.util.Arrays;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.HashMap;
27 import java.util.LinkedHashMap;
28 import java.util.LinkedHashSet;
29 import java.util.List;
30 import java.util.Map;
31 import java.util.Properties;
32 import java.util.Set;
33
34 import org.apache.maven.RepositoryUtils;
35 import org.apache.maven.artifact.Artifact;
36 import org.apache.maven.artifact.ArtifactUtils;
37 import org.apache.maven.artifact.factory.ArtifactFactory;
38 import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
39 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
40 import org.apache.maven.artifact.metadata.ResolutionGroup;
41 import org.apache.maven.artifact.repository.ArtifactRepository;
42 import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
43 import org.apache.maven.artifact.repository.metadata.Metadata;
44 import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
45 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager;
46 import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
47 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
48 import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
49 import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
50 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
51 import org.apache.maven.artifact.resolver.filter.ExclusionArtifactFilter;
52 import org.apache.maven.artifact.versioning.ArtifactVersion;
53 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
54 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
55 import org.apache.maven.artifact.versioning.VersionRange;
56 import org.apache.maven.execution.MavenSession;
57 import org.apache.maven.model.Dependency;
58 import org.apache.maven.model.DependencyManagement;
59 import org.apache.maven.model.DistributionManagement;
60 import org.apache.maven.model.Model;
61 import org.apache.maven.model.Relocation;
62 import org.apache.maven.model.building.ModelBuildingException;
63 import org.apache.maven.model.building.ModelBuildingRequest;
64 import org.apache.maven.model.building.ModelProblem;
65 import org.apache.maven.model.resolution.UnresolvableModelException;
66 import org.apache.maven.plugin.LegacySupport;
67 import org.apache.maven.project.DefaultProjectBuildingRequest;
68 import org.apache.maven.project.MavenProject;
69 import org.apache.maven.project.ProjectBuilder;
70 import org.apache.maven.project.ProjectBuildingException;
71 import org.apache.maven.project.ProjectBuildingRequest;
72 import org.apache.maven.properties.internal.EnvironmentUtils;
73 import org.apache.maven.properties.internal.SystemProperties;
74 import org.apache.maven.repository.internal.MavenWorkspaceReader;
75 import org.apache.maven.repository.legacy.metadata.DefaultMetadataResolutionRequest;
76 import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
77 import org.codehaus.plexus.PlexusContainer;
78 import org.codehaus.plexus.component.annotations.Component;
79 import org.codehaus.plexus.component.annotations.Requirement;
80 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
81 import org.codehaus.plexus.logging.Logger;
82 import org.eclipse.aether.RepositorySystemSession;
83 import org.eclipse.aether.repository.RepositoryPolicy;
84 import org.eclipse.aether.repository.WorkspaceReader;
85 import org.eclipse.aether.transfer.ArtifactNotFoundException;
86
87
88
89
90 @Component(role = ArtifactMetadataSource.class, hint = "maven")
91 public class MavenMetadataSource implements ArtifactMetadataSource {
92 @Requirement
93 private RepositoryMetadataManager repositoryMetadataManager;
94
95 @Requirement
96 private ArtifactFactory repositorySystem;
97
98
99
100 private ProjectBuilder projectBuilder;
101
102 @Requirement
103 private PlexusContainer container;
104
105 @Requirement
106 private Logger logger;
107
108 @Requirement
109 private MavenMetadataCache cache;
110
111 @Requirement
112 private LegacySupport legacySupport;
113
114 private void injectSession(MetadataResolutionRequest request) {
115 RepositorySystemSession session = legacySupport.getRepositorySession();
116
117 if (session != null) {
118 request.setOffline(session.isOffline());
119 request.setForceUpdate(RepositoryPolicy.UPDATE_POLICY_ALWAYS.equals(session.getUpdatePolicy()));
120 }
121 }
122
123 public ResolutionGroup retrieve(
124 Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories)
125 throws ArtifactMetadataRetrievalException {
126 return retrieve(artifact, localRepository, remoteRepositories, false);
127 }
128
129 public ResolutionGroup retrieve(
130 Artifact artifact,
131 ArtifactRepository localRepository,
132 List<ArtifactRepository> remoteRepositories,
133 boolean resolveManagedVersions)
134 throws ArtifactMetadataRetrievalException {
135 MetadataResolutionRequest request = new DefaultMetadataResolutionRequest();
136 injectSession(request);
137 request.setArtifact(artifact);
138 request.setLocalRepository(localRepository);
139 request.setRemoteRepositories(remoteRepositories);
140 request.setResolveManagedVersions(resolveManagedVersions);
141 return retrieve(request);
142 }
143
144 public ResolutionGroup retrieve(MetadataResolutionRequest request) throws ArtifactMetadataRetrievalException {
145 Artifact artifact = request.getArtifact();
146
147
148
149
150
151 if (artifact.getScope() != null && artifact.getScope().equals(Artifact.SCOPE_SYSTEM)) {
152 return new ResolutionGroup(null, null, null);
153 }
154
155 ResolutionGroup cached = cache.get(
156 artifact,
157 request.isResolveManagedVersions(),
158 request.getLocalRepository(),
159 request.getRemoteRepositories());
160
161 if (cached != null
162
163 && (!request.isForceUpdate() || hasFile(cached.getPomArtifact()))) {
164 return cached;
165 }
166
167 List<Dependency> dependencies;
168
169 List<Dependency> managedDependencies = null;
170
171 List<ArtifactRepository> pomRepositories = null;
172
173 Artifact pomArtifact;
174
175 Artifact relocatedArtifact = null;
176
177
178 final WorkspaceReader workspace = legacySupport.getRepositorySession().getWorkspaceReader();
179 Model model = null;
180 if (workspace instanceof MavenWorkspaceReader) {
181 model = ((MavenWorkspaceReader) workspace).findModel(RepositoryUtils.toArtifact(artifact));
182 }
183
184 if (model != null) {
185 pomArtifact = artifact;
186 dependencies = model.getDependencies();
187 DependencyManagement dependencyManagement = model.getDependencyManagement();
188 managedDependencies = dependencyManagement == null ? null : dependencyManagement.getDependencies();
189 MavenSession session = legacySupport.getSession();
190 if (session != null) {
191 MavenProject project = session.getProjectMap()
192 .get(ArtifactUtils.key(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion()));
193 pomRepositories = project.getRemoteArtifactRepositories();
194 } else {
195 pomRepositories = new ArrayList<>();
196 }
197 } else if (artifact instanceof ArtifactWithDependencies) {
198 pomArtifact = artifact;
199
200 dependencies = ((ArtifactWithDependencies) artifact).getDependencies();
201
202 managedDependencies = ((ArtifactWithDependencies) artifact).getManagedDependencies();
203 } else {
204 ProjectRelocation rel = retrieveRelocatedProject(artifact, request);
205
206 if (rel == null) {
207 return null;
208 }
209
210 pomArtifact = rel.pomArtifact;
211
212 relocatedArtifact = rel.relocatedArtifact;
213
214 if (rel.project == null) {
215
216
217 dependencies = Collections.emptyList();
218 } else {
219 dependencies = rel.project.getDependencies();
220
221 DependencyManagement depMgmt = rel.project.getDependencyManagement();
222 managedDependencies = (depMgmt != null) ? depMgmt.getDependencies() : null;
223
224 pomRepositories = rel.project.getRemoteArtifactRepositories();
225 }
226 }
227
228 Set<Artifact> artifacts = Collections.emptySet();
229
230 if (!artifact.getArtifactHandler().isIncludesDependencies()) {
231 artifacts = new LinkedHashSet<>();
232
233 for (Dependency dependency : dependencies) {
234 Artifact dependencyArtifact = createDependencyArtifact(dependency, artifact, pomArtifact);
235
236 if (dependencyArtifact != null) {
237 artifacts.add(dependencyArtifact);
238 }
239 }
240 }
241
242 Map<String, Artifact> managedVersions = null;
243
244 if (managedDependencies != null && request.isResolveManagedVersions()) {
245 managedVersions = new HashMap<>();
246
247 for (Dependency managedDependency : managedDependencies) {
248 Artifact managedArtifact = createDependencyArtifact(managedDependency, null, pomArtifact);
249
250 managedVersions.put(managedDependency.getManagementKey(), managedArtifact);
251 }
252 }
253
254 List<ArtifactRepository> aggregatedRepositories =
255 aggregateRepositories(request.getRemoteRepositories(), pomRepositories);
256
257 ResolutionGroup result =
258 new ResolutionGroup(pomArtifact, relocatedArtifact, artifacts, managedVersions, aggregatedRepositories);
259
260 cache.put(
261 artifact,
262 request.isResolveManagedVersions(),
263 request.getLocalRepository(),
264 request.getRemoteRepositories(),
265 result);
266
267 return result;
268 }
269
270 private boolean hasFile(Artifact artifact) {
271 return artifact != null
272 && artifact.getFile() != null
273 && artifact.getFile().exists();
274 }
275
276 private List<ArtifactRepository> aggregateRepositories(
277 List<ArtifactRepository> requestRepositories, List<ArtifactRepository> pomRepositories) {
278 List<ArtifactRepository> repositories = requestRepositories;
279
280 if (pomRepositories != null && !pomRepositories.isEmpty()) {
281 Map<String, ArtifactRepository> repos = new LinkedHashMap<>();
282
283 for (ArtifactRepository repo : requestRepositories) {
284 if (!repos.containsKey(repo.getId())) {
285 repos.put(repo.getId(), repo);
286 }
287 }
288
289 for (ArtifactRepository repo : pomRepositories) {
290 if (!repos.containsKey(repo.getId())) {
291 repos.put(repo.getId(), repo);
292 }
293 }
294
295 repositories = new ArrayList<>(repos.values());
296 }
297
298 return repositories;
299 }
300
301 private Artifact createDependencyArtifact(Dependency dependency, Artifact owner, Artifact pom)
302 throws ArtifactMetadataRetrievalException {
303 try {
304 String inheritedScope = (owner != null) ? owner.getScope() : null;
305
306 ArtifactFilter inheritedFilter = (owner != null) ? owner.getDependencyFilter() : null;
307
308 return createDependencyArtifact(repositorySystem, dependency, inheritedScope, inheritedFilter);
309 } catch (InvalidVersionSpecificationException e) {
310 throw new ArtifactMetadataRetrievalException(
311 "Invalid version for dependency " + dependency.getManagementKey() + ": " + e.getMessage(), e, pom);
312 }
313 }
314
315 private static Artifact createDependencyArtifact(
316 ArtifactFactory factory, Dependency dependency, String inheritedScope, ArtifactFilter inheritedFilter)
317 throws InvalidVersionSpecificationException {
318 String effectiveScope = getEffectiveScope(dependency.getScope(), inheritedScope);
319
320 if (effectiveScope == null) {
321 return null;
322 }
323
324 VersionRange versionRange = VersionRange.createFromVersionSpec(dependency.getVersion());
325
326 Artifact dependencyArtifact = factory.createDependencyArtifact(
327 dependency.getGroupId(),
328 dependency.getArtifactId(),
329 versionRange,
330 dependency.getType(),
331 dependency.getClassifier(),
332 effectiveScope,
333 dependency.isOptional());
334
335 ArtifactFilter dependencyFilter = inheritedFilter;
336
337 if (dependencyFilter != null && !dependencyFilter.include(dependencyArtifact)) {
338 return null;
339 }
340
341 if (Artifact.SCOPE_SYSTEM.equals(effectiveScope)) {
342 dependencyArtifact.setFile(new File(dependency.getSystemPath()));
343 }
344
345 dependencyArtifact.setDependencyFilter(createDependencyFilter(dependency, dependencyFilter));
346
347 return dependencyArtifact;
348 }
349
350 private static String getEffectiveScope(String originalScope, String inheritedScope) {
351 String effectiveScope = Artifact.SCOPE_RUNTIME;
352
353 if (originalScope == null) {
354 originalScope = Artifact.SCOPE_COMPILE;
355 }
356
357 if (inheritedScope == null) {
358
359 effectiveScope = originalScope;
360 } else if (Artifact.SCOPE_TEST.equals(originalScope) || Artifact.SCOPE_PROVIDED.equals(originalScope)) {
361
362 effectiveScope = null;
363 } else if (Artifact.SCOPE_SYSTEM.equals(originalScope)) {
364
365 effectiveScope = Artifact.SCOPE_SYSTEM;
366 } else if (Artifact.SCOPE_COMPILE.equals(originalScope) && Artifact.SCOPE_COMPILE.equals(inheritedScope)) {
367
368 effectiveScope = Artifact.SCOPE_COMPILE;
369 } else if (Artifact.SCOPE_TEST.equals(inheritedScope)) {
370 effectiveScope = Artifact.SCOPE_TEST;
371 } else if (Artifact.SCOPE_PROVIDED.equals(inheritedScope)) {
372 effectiveScope = Artifact.SCOPE_PROVIDED;
373 }
374
375 return effectiveScope;
376 }
377
378 private static ArtifactFilter createDependencyFilter(Dependency dependency, ArtifactFilter inheritedFilter) {
379 ArtifactFilter effectiveFilter = inheritedFilter;
380
381 if (!dependency.getExclusions().isEmpty()) {
382 effectiveFilter = new ExclusionArtifactFilter(dependency.getExclusions());
383
384 if (inheritedFilter != null) {
385 effectiveFilter = new AndArtifactFilter(Arrays.asList(inheritedFilter, effectiveFilter));
386 }
387 }
388
389 return effectiveFilter;
390 }
391
392 public List<ArtifactVersion> retrieveAvailableVersions(
393 Artifact artifact, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories)
394 throws ArtifactMetadataRetrievalException {
395 MetadataResolutionRequest request = new DefaultMetadataResolutionRequest();
396 injectSession(request);
397 request.setArtifact(artifact);
398 request.setLocalRepository(localRepository);
399 request.setRemoteRepositories(remoteRepositories);
400 return retrieveAvailableVersions(request);
401 }
402
403 public List<ArtifactVersion> retrieveAvailableVersions(MetadataResolutionRequest request)
404 throws ArtifactMetadataRetrievalException {
405 RepositoryMetadata metadata = new ArtifactRepositoryMetadata(request.getArtifact());
406
407 try {
408 repositoryMetadataManager.resolve(metadata, request);
409 } catch (RepositoryMetadataResolutionException e) {
410 throw new ArtifactMetadataRetrievalException(e.getMessage(), e, request.getArtifact());
411 }
412
413 List<String> availableVersions = request.getLocalRepository().findVersions(request.getArtifact());
414
415 return retrieveAvailableVersionsFromMetadata(metadata.getMetadata(), availableVersions);
416 }
417
418 public List<ArtifactVersion> retrieveAvailableVersionsFromDeploymentRepository(
419 Artifact artifact, ArtifactRepository localRepository, ArtifactRepository deploymentRepository)
420 throws ArtifactMetadataRetrievalException {
421 RepositoryMetadata metadata = new ArtifactRepositoryMetadata(artifact);
422
423 try {
424 repositoryMetadataManager.resolveAlways(metadata, localRepository, deploymentRepository);
425 } catch (RepositoryMetadataResolutionException e) {
426 throw new ArtifactMetadataRetrievalException(e.getMessage(), e, artifact);
427 }
428
429 List<String> availableVersions = localRepository.findVersions(artifact);
430
431 return retrieveAvailableVersionsFromMetadata(metadata.getMetadata(), availableVersions);
432 }
433
434 private List<ArtifactVersion> retrieveAvailableVersionsFromMetadata(
435 Metadata repoMetadata, List<String> availableVersions) {
436 Collection<String> versions = new LinkedHashSet<>();
437
438 if ((repoMetadata != null) && (repoMetadata.getVersioning() != null)) {
439 versions.addAll(repoMetadata.getVersioning().getVersions());
440 }
441
442 versions.addAll(availableVersions);
443
444 List<ArtifactVersion> artifactVersions = new ArrayList<>(versions.size());
445
446 for (String version : versions) {
447 artifactVersions.add(new DefaultArtifactVersion(version));
448 }
449
450 return artifactVersions;
451 }
452
453
454 @Deprecated
455 public static Set<Artifact> createArtifacts(
456 ArtifactFactory artifactFactory,
457 List<Dependency> dependencies,
458 String inheritedScope,
459 ArtifactFilter dependencyFilter,
460 MavenProject project)
461 throws InvalidDependencyVersionException {
462 Set<Artifact> artifacts = new LinkedHashSet<>();
463
464 for (Dependency d : dependencies) {
465 Artifact dependencyArtifact;
466 try {
467 dependencyArtifact = createDependencyArtifact(artifactFactory, d, inheritedScope, dependencyFilter);
468 } catch (InvalidVersionSpecificationException e) {
469 throw new InvalidDependencyVersionException(project.getId(), d, project.getFile(), e);
470 }
471
472 if (dependencyArtifact != null) {
473 artifacts.add(dependencyArtifact);
474 }
475 }
476
477 return artifacts;
478 }
479
480 private ProjectBuilder getProjectBuilder() {
481 if (projectBuilder != null) {
482 return projectBuilder;
483 }
484
485 try {
486 projectBuilder = container.lookup(ProjectBuilder.class);
487 } catch (ComponentLookupException e) {
488
489 }
490
491 return projectBuilder;
492 }
493
494 @SuppressWarnings("checkstyle:methodlength")
495 private ProjectRelocation retrieveRelocatedProject(Artifact artifact, MetadataResolutionRequest repositoryRequest)
496 throws ArtifactMetadataRetrievalException {
497 MavenProject project;
498
499 Artifact pomArtifact;
500 Artifact relocatedArtifact = null;
501 boolean done = false;
502 do {
503 project = null;
504
505 pomArtifact = repositorySystem.createProjectArtifact(
506 artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getScope());
507
508 if ("pom".equals(artifact.getType())) {
509 pomArtifact.setFile(artifact.getFile());
510 }
511
512 if (Artifact.SCOPE_SYSTEM.equals(artifact.getScope())) {
513 done = true;
514 } else {
515 try {
516 ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
517 configuration.setLocalRepository(repositoryRequest.getLocalRepository());
518 configuration.setRemoteRepositories(repositoryRequest.getRemoteRepositories());
519 configuration.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL);
520 configuration.setProcessPlugins(false);
521 configuration.setRepositoryMerging(ProjectBuildingRequest.RepositoryMerging.REQUEST_DOMINANT);
522 MavenSession session = legacySupport.getSession();
523 if (session != null) {
524 configuration.setSystemProperties(session.getSystemProperties());
525 configuration.setUserProperties(session.getUserProperties());
526 } else {
527 configuration.setSystemProperties(getSystemProperties());
528 configuration.setUserProperties(new Properties());
529 }
530 configuration.setRepositorySession(legacySupport.getRepositorySession());
531
532 project = getProjectBuilder()
533 .build(pomArtifact, configuration)
534 .getProject();
535 } catch (ProjectBuildingException e) {
536 ModelProblem missingParentPom = hasMissingParentPom(e);
537 if (missingParentPom != null) {
538 throw new ArtifactMetadataRetrievalException(
539 "Failed to process POM for " + artifact.getId() + ": " + missingParentPom.getMessage(),
540 missingParentPom.getException(),
541 artifact);
542 }
543
544 String message;
545
546 if (isMissingPom(e)) {
547 message = "Missing POM for " + artifact.getId();
548 } else if (isNonTransferrablePom(e)) {
549 throw new ArtifactMetadataRetrievalException(
550 "Failed to retrieve POM for " + artifact.getId() + ": "
551 + e.getCause().getMessage(),
552 e.getCause(),
553 artifact);
554 } else {
555 message = "Invalid POM for " + artifact.getId()
556 + ", transitive dependencies (if any) will not be available"
557 + ", enable debug logging for more details";
558 }
559
560 if (logger.isDebugEnabled()) {
561 message += ": " + e.getMessage();
562 }
563
564 logger.warn(message);
565 }
566
567 if (project != null) {
568 Relocation relocation = null;
569
570 DistributionManagement distMgmt = project.getDistributionManagement();
571 if (distMgmt != null) {
572 relocation = distMgmt.getRelocation();
573
574 artifact.setDownloadUrl(distMgmt.getDownloadUrl());
575 pomArtifact.setDownloadUrl(distMgmt.getDownloadUrl());
576 }
577
578 if (relocation != null) {
579 if (relocation.getGroupId() != null) {
580 artifact.setGroupId(relocation.getGroupId());
581 relocatedArtifact = artifact;
582 project.setGroupId(relocation.getGroupId());
583 }
584 if (relocation.getArtifactId() != null) {
585 artifact.setArtifactId(relocation.getArtifactId());
586 relocatedArtifact = artifact;
587 project.setArtifactId(relocation.getArtifactId());
588 }
589 if (relocation.getVersion() != null) {
590
591 artifact.setVersionRange(VersionRange.createFromVersion(relocation.getVersion()));
592 relocatedArtifact = artifact;
593 project.setVersion(relocation.getVersion());
594 }
595
596 if (artifact.getDependencyFilter() != null
597 && !artifact.getDependencyFilter().include(artifact)) {
598 return null;
599 }
600
601
602
603
604 List<ArtifactVersion> available = artifact.getAvailableVersions();
605 if (available != null && !available.isEmpty()) {
606 MetadataResolutionRequest metadataRequest =
607 new DefaultMetadataResolutionRequest(repositoryRequest);
608 metadataRequest.setArtifact(artifact);
609 available = retrieveAvailableVersions(metadataRequest);
610 artifact.setAvailableVersions(available);
611 }
612
613 String message = "\n This artifact has been relocated to " + artifact.getGroupId() + ":"
614 + artifact.getArtifactId() + ":" + artifact.getVersion() + ".\n";
615
616 if (relocation.getMessage() != null) {
617 message += " " + relocation.getMessage() + "\n";
618 }
619
620 if (artifact.getDependencyTrail() != null
621 && artifact.getDependencyTrail().size() == 1) {
622 logger.warn("While downloading " + pomArtifact.getGroupId() + ":"
623 + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n");
624 } else {
625 logger.debug("While downloading " + pomArtifact.getGroupId() + ":"
626 + pomArtifact.getArtifactId() + ":" + pomArtifact.getVersion() + message + "\n");
627 }
628 } else {
629 done = true;
630 }
631 } else {
632 done = true;
633 }
634 }
635 } while (!done);
636
637 ProjectRelocation rel = new ProjectRelocation();
638 rel.project = project;
639 rel.pomArtifact = pomArtifact;
640 rel.relocatedArtifact = relocatedArtifact;
641
642 return rel;
643 }
644
645 private ModelProblem hasMissingParentPom(ProjectBuildingException e) {
646 if (e.getCause() instanceof ModelBuildingException) {
647 ModelBuildingException mbe = (ModelBuildingException) e.getCause();
648 for (ModelProblem problem : mbe.getProblems()) {
649 if (problem.getException() instanceof UnresolvableModelException) {
650 return problem;
651 }
652 }
653 }
654 return null;
655 }
656
657 private boolean isMissingPom(Exception e) {
658 if (e.getCause() instanceof MultipleArtifactsNotFoundException) {
659 return true;
660 }
661 return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException
662 && e.getCause().getCause() instanceof ArtifactNotFoundException;
663 }
664
665 private boolean isNonTransferrablePom(Exception e) {
666 if (e.getCause() instanceof ArtifactResolutionException) {
667 return true;
668 }
669 return e.getCause() instanceof org.eclipse.aether.resolution.ArtifactResolutionException
670 && !(e.getCause().getCause() instanceof ArtifactNotFoundException);
671 }
672
673 private Properties getSystemProperties() {
674 Properties props = new Properties();
675
676 EnvironmentUtils.addEnvVars(props);
677
678 SystemProperties.addSystemProperties(props);
679
680 return props;
681 }
682
683 private static final class ProjectRelocation {
684 private MavenProject project;
685
686 private Artifact pomArtifact;
687
688 private Artifact relocatedArtifact;
689 }
690 }