1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.repository;
20
21 import java.io.File;
22 import org.apache.maven.artifact.ArtifactUtils;
23 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
24 import org.apache.maven.model.Dependency;
25
26
27
28
29
30
31 public class VersionNotFoundException extends Exception {
32 private Dependency dependency;
33
34 private String projectId;
35 private File pomFile;
36 private InvalidVersionSpecificationException cause;
37
38 public VersionNotFoundException(
39 String projectId, Dependency dependency, File pomFile, InvalidVersionSpecificationException cause) {
40 super(
41 projectId + ", " + formatLocationInPom(dependency) + " " + dependency.getVersion() + ", pom file "
42 + pomFile,
43 cause);
44
45 this.projectId = projectId;
46
47 this.pomFile = pomFile;
48
49 this.cause = cause;
50
51 this.dependency = dependency;
52 }
53
54 private static String formatLocationInPom(Dependency dependency) {
55 return "Dependency: " + ArtifactUtils.versionlessKey(dependency.getGroupId(), dependency.getArtifactId());
56 }
57
58 public Dependency getDependency() {
59 return dependency;
60 }
61
62 public String getProjectId() {
63 return projectId;
64 }
65
66 public File getPomFile() {
67 return pomFile;
68 }
69
70 public InvalidVersionSpecificationException getCauseException() {
71 return cause;
72 }
73 }