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 public class PluginManagerException
38 extends Exception
39 {
40
41 private final String pluginGroupId;
42
43 private final String pluginArtifactId;
44
45 private final String pluginVersion;
46
47 private String goal;
48
49 private MavenProject project;
50
51 protected PluginManagerException( Plugin plugin, String message, MavenProject project, Throwable cause )
52 {
53 super( message, cause );
54
55 this.project = project;
56 pluginGroupId = plugin.getGroupId();
57 pluginArtifactId = plugin.getArtifactId();
58 pluginVersion = plugin.getVersion();
59 }
60
61 public PluginManagerException( Plugin plugin, String message, Throwable cause )
62 {
63 super( message, cause );
64
65 pluginGroupId = plugin.getGroupId();
66 pluginArtifactId = plugin.getArtifactId();
67 pluginVersion = plugin.getVersion();
68 }
69
70 protected PluginManagerException( MojoDescriptor mojoDescriptor, String message, Throwable cause )
71 {
72 super( message, cause );
73 pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
74 pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
75 pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
76 goal = mojoDescriptor.getGoal();
77 }
78
79 protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message )
80 {
81 super( message );
82 this.project = project;
83 pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
84 pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
85 pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
86 goal = mojoDescriptor.getGoal();
87 }
88
89 protected PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message,
90 Throwable cause )
91 {
92 super( message, cause );
93 this.project = project;
94 pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
95 pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
96 pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
97 goal = mojoDescriptor.getGoal();
98 }
99
100 public PluginManagerException( Plugin plugin, InvalidVersionSpecificationException cause )
101 {
102 super( cause );
103
104 pluginGroupId = plugin.getGroupId();
105 pluginArtifactId = plugin.getArtifactId();
106 pluginVersion = plugin.getVersion();
107 }
108
109 public PluginManagerException( Plugin plugin, String message, PlexusConfigurationException cause )
110 {
111 super( message, cause );
112
113 pluginGroupId = plugin.getGroupId();
114 pluginArtifactId = plugin.getArtifactId();
115 pluginVersion = plugin.getVersion();
116 }
117
118 public PluginManagerException( Plugin plugin, String message, ComponentRepositoryException cause )
119 {
120 super( message, cause );
121
122 pluginGroupId = plugin.getGroupId();
123 pluginArtifactId = plugin.getArtifactId();
124 pluginVersion = plugin.getVersion();
125 }
126
127 public PluginManagerException( MojoDescriptor mojoDescriptor, MavenProject project, String message,
128 NoSuchRealmException cause )
129 {
130 super( message, cause );
131
132 this.project = project;
133 pluginGroupId = mojoDescriptor.getPluginDescriptor().getGroupId();
134 pluginArtifactId = mojoDescriptor.getPluginDescriptor().getArtifactId();
135 pluginVersion = mojoDescriptor.getPluginDescriptor().getVersion();
136 goal = mojoDescriptor.getGoal();
137 }
138
139 public PluginManagerException( MojoDescriptor mojoDescriptor, String message, MavenProject project,
140 PlexusContainerException cause )
141 {
142 super( message, cause );
143
144 this.project = project;
145
146 PluginDescriptor pd = mojoDescriptor.getPluginDescriptor();
147 pluginGroupId = pd.getGroupId();
148 pluginArtifactId = pd.getArtifactId();
149 pluginVersion = pd.getVersion();
150
151 goal = mojoDescriptor.getGoal();
152 }
153
154 public PluginManagerException( Plugin plugin, String message, PlexusContainerException cause )
155 {
156 super( message, cause );
157
158 pluginGroupId = plugin.getGroupId();
159 pluginArtifactId = plugin.getArtifactId();
160 pluginVersion = plugin.getVersion();
161 }
162
163 public PluginManagerException( Plugin plugin, String message, MavenProject project )
164 {
165 super( message );
166
167 pluginGroupId = plugin.getGroupId();
168 pluginArtifactId = plugin.getArtifactId();
169 pluginVersion = plugin.getVersion();
170 this.project = project;
171 }
172
173 public String getPluginGroupId()
174 {
175 return pluginGroupId;
176 }
177
178 public String getPluginArtifactId()
179 {
180 return pluginArtifactId;
181 }
182
183 public String getPluginVersion()
184 {
185 return pluginVersion;
186 }
187
188 public String getGoal()
189 {
190 return goal;
191 }
192
193 public MavenProject getProject()
194 {
195 return project;
196 }
197 }