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