1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin;
20
21 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
22 import org.apache.maven.model.Plugin;
23 import org.apache.maven.plugin.descriptor.MojoDescriptor;
24 import org.apache.maven.plugin.descriptor.PluginDescriptor;
25 import org.apache.maven.project.MavenProject;
26 import org.codehaus.plexus.PlexusContainerException;
27 import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
28 import org.codehaus.plexus.component.repository.exception.ComponentRepositoryException;
29 import org.codehaus.plexus.configuration.PlexusConfigurationException;
30
31
32
33
34 public class PluginManagerException extends Exception {
35
36 private final String pluginGroupId;
37
38 private final String pluginArtifactId;
39
40 private final String pluginVersion;
41
42 private String goal;
43
44 private MavenProject project;
45
46 protected PluginManagerException(Plugin plugin, String message, MavenProject project, Throwable cause) {
47 super(message, cause);
48
49 this.project = project;
50 pluginGroupId = plugin.getGroupId();
51 pluginArtifactId = plugin.getArtifactId();
52 pluginVersion = plugin.getVersion();
53 }
54
55 public PluginManagerException(Plugin plugin, String message, Throwable cause) {
56 super(message, cause);
57
58 pluginGroupId = plugin.getGroupId();
59 pluginArtifactId = plugin.getArtifactId();
60 pluginVersion = plugin.getVersion();
61 }
62
63 protected PluginManagerException(MojoDescriptor mojoDescriptor, String message, Throwable cause) {
64 super(message, cause);
65 pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
66 pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
67 pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
68 goal = mojoDescriptor.getGoal();
69 }
70
71 protected PluginManagerException(MojoDescriptor mojoDescriptor, MavenProject project, String message) {
72 super(message);
73 this.project = project;
74 pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
75 pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
76 pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
77 goal = mojoDescriptor.getGoal();
78 }
79
80 protected PluginManagerException(
81 MojoDescriptor mojoDescriptor, MavenProject project, String message, Throwable cause) {
82 super(message, cause);
83 this.project = project;
84 pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
85 pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
86 pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
87 goal = mojoDescriptor.getGoal();
88 }
89
90 public PluginManagerException(Plugin plugin, InvalidVersionSpecificationException cause) {
91 super(cause);
92
93 pluginGroupId = plugin.getGroupId();
94 pluginArtifactId = plugin.getArtifactId();
95 pluginVersion = plugin.getVersion();
96 }
97
98
99
100
101
102
103 @Deprecated
104 public PluginManagerException(Plugin plugin, String message, PlexusConfigurationException cause) {
105 this(plugin, message, (Throwable) cause);
106 }
107
108
109
110
111
112
113 @Deprecated
114 public PluginManagerException(Plugin plugin, String message, ComponentRepositoryException cause) {
115 this(plugin, message, (Throwable) cause);
116 }
117
118 public PluginManagerException(
119 MojoDescriptor mojoDescriptor, MavenProject project, String message, NoSuchRealmException cause) {
120 super(message, cause);
121
122 this.project = project;
123 pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
124 pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
125 pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
126 goal = mojoDescriptor.getGoal();
127 }
128
129 public PluginManagerException(
130 MojoDescriptor mojoDescriptor, String message, MavenProject project, PlexusContainerException cause) {
131 super(message, cause);
132
133 this.project = project;
134
135 PluginDescriptor pd = mojoDescriptor.getPluginDescriptor();
136 pluginGroupId = pd.getGroupId();
137 pluginArtifactId = pd.getArtifactId();
138 pluginVersion = pd.getVersion();
139
140 goal = mojoDescriptor.getGoal();
141 }
142
143
144
145
146
147
148 @Deprecated
149 public PluginManagerException(Plugin plugin, String message, PlexusContainerException cause) {
150 this(plugin, message, (Throwable) cause);
151 }
152
153 public PluginManagerException(Plugin plugin, String message, MavenProject project) {
154 super(message);
155
156 pluginGroupId = plugin.getGroupId();
157 pluginArtifactId = plugin.getArtifactId();
158 pluginVersion = plugin.getVersion();
159 this.project = project;
160 }
161
162 public String getPluginGroupId() {
163 return pluginGroupId;
164 }
165
166 public String getPluginArtifactId() {
167 return pluginArtifactId;
168 }
169
170 public String getPluginVersion() {
171 return pluginVersion;
172 }
173
174 public String getGoal() {
175 return goal;
176 }
177
178 public MavenProject getProject() {
179 return project;
180 }
181 }