View Javadoc

1   /**
2    * Copyright 2011-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.maven.plugins.graph.mojo;
17  
18  import org.kuali.maven.plugins.graph.pojo.Conflicts;
19  import org.kuali.maven.plugins.graph.pojo.Direction;
20  import org.kuali.maven.plugins.graph.pojo.Display;
21  
22  /**
23   * <p>
24   * </p>
25   *
26   */
27  public abstract class BaseGraphMojo extends BaseMavenMojo {
28  
29      /**
30       * <p>
31       * Controls what dependencies are displayed on the graph by applying different filtering techniques. Valid options
32       * are <code>PATH</code>, <code>TREE</code>, and <code>PT</code> (path and tree).
33       * </p>
34       *
35       * <p>
36       * NOTE: Support for display types other than <code>TREE</code> should be considered experimental. <code>PATH</code>
37       * and <code>PT</code> are not fully implemented or tested. Use at your own risk.
38       * </p>
39       *
40       * <p>
41       * <code>TREE</code> prunes the dependency tree from the top down. Recursive traversal of transitive dependencies
42       * stops when a dependency does not match the filter criteria. Any further transitive dependencies in that part of
43       * the dependency tree are not displayed.
44       * </p>
45       *
46       * <p>
47       * <code>PATH</code> searches the entire tree for any dependencies matching the filter criteria. All matching
48       * dependencies are displayed. In addition, the dependencies in the path from any matching dependency back to the
49       * top of the dependency tree are displayed. Dependencies in the path from a matching dependency to the top of the
50       * tree are always displayed, even if they do not match the filter criteria themselves.
51       * </p>
52       *
53       * <p>
54       * <code>PT</code> is similar to <code>PATH</code>. The difference between <code>PT</code> and <code>PATH</code> is
55       * that <code>PT</code> shows the transitive dependencies of dependencies matching the filter criteria in addition
56       * to the dependencies in the path back to the top of the dependency tree.
57       * </p>
58       *
59       * @parameter expression="${graph.display}" default-value="TREE"
60       */
61      private Display display;
62  
63      /**
64       * <p>
65       * The title for the graph
66       * </p>
67       *
68       * @parameter expression="${graph.title}" default-value="Dependency Graph for ${project.name}"
69       */
70      private String title;
71  
72      /**
73       * <p>
74       * If true, the .dot text file Graphviz uses to draw the graph is retained
75       * </p>
76       *
77       * @parameter expression="${graph.keepDotFile}" default-value="false"
78       */
79      private boolean keepDotFile;
80  
81      /**
82       * <p>
83       * The direction for the graph layout. Valid values are TB, LR, BT, RL. Top to bottom, left to right, bottom to top,
84       * and right to left, respectively.
85       * </p>
86       *
87       * @required
88       * @parameter expression="${graph.direction}" default-value="TB"
89       */
90      private Direction direction;
91  
92      /**
93       * <p>
94       * If true, artifact group id's are displayed on the graph.
95       * </p>
96       *
97       * @parameter expression="${graph.showGroupIds}" default-value="true"
98       */
99      private boolean showGroupIds;
100 
101     /**
102      * <p>
103      * If true, artifact id's are displayed on the graph.
104      * </p>
105      *
106      * @parameter expression="${graph.showArtifactIds}" default-value="true"
107      */
108     private boolean showArtifactIds;
109 
110     /**
111      * <p>
112      * If true, artifact versions's are displayed on the graph.
113      * </p>
114      *
115      * @parameter expression="${graph.showVersions}" default-value="true"
116      */
117     private boolean showVersions;
118 
119     /**
120      * <p>
121      * If true, artifact classifiers's are displayed on the graph.
122      * </p>
123      *
124      * @parameter expression="${graph.showClassifiers}" default-value="true"
125      */
126     private boolean showClassifiers;
127 
128     /**
129      * <p>
130      * If true, artifact types (aka "packaging") are displayed on the graph
131      * </p>
132      *
133      * @parameter expression="${graph.showTypes}" default-value="true"
134      */
135     private boolean showTypes;
136 
137     /**
138      * <p>
139      * If true, duplicate dependencies are displayed on the graph.
140      * </p>
141      *
142      * @parameter expression="${graph.showDuplicates}" default-value="false"
143      */
144     private boolean showDuplicates;
145 
146     /**
147      * <p>
148      * Determines how conflicts in the dependency tree are displayed. Valid options are <code>IGNORE</code>,
149      * <code>LABEL</code>, and <code>SHOW</code>.
150      * </p>
151      *
152      * <p>
153      * <code>IGNORE</code>, ignores conflicts and draws the graph without any reference to them.
154      * </p>
155      *
156      * <p>
157      * <code>LABEL</code>, draws a red line with the word "conflict" for any spots in the dependency tree where there
158      * are conflicts.
159      * </p>
160      *
161      * <p>
162      * <code>SHOW</code>, draws a red line, and also shows what version of the artifact was conflicted out of the build.
163      * </p>
164      *
165      * <p>
166      * Maven supports the resolution of artifact versions by way of nearest-wins. That is, for any set of dependencies
167      * that share the same groupId:artifactId:type:classifier, the one declared nearest to the current project in the
168      * dependency tree will be selected for use.
169      * </p>
170      *
171      * @parameter expression="${graph.conflicts}" default-value="IGNORE"
172      */
173     private Conflicts conflicts;
174 
175     /**
176      * <p>
177      * If true, any dependency marked as optional will have all of its transitive dependencies displayed as optional
178      * also.
179      * </p>
180      *
181      * @parameter expression="${graph.cascadeOptional}" default-value="true"
182      */
183     private boolean cascadeOptional;
184 
185     /**
186      * <p>
187      * If true, any filters applied to the dependency tree are shown in the legend.
188      * </p>
189      *
190      * @parameter expression="${graph.showLegend}" default-value="true"
191      */
192     private boolean showLegend;
193 
194     /**
195      * <p>
196      * If true, the title for the graph will be displayed.
197      * </p>
198      *
199      * @parameter expression="${graph.showTitle}" default-value="true"
200      */
201     private boolean showTitle;
202 
203     /**
204      * <p>
205      * If true, the Graphviz "dot" binary is executed to produce a graph from the .dot text file
206      * </p>
207      *
208      * @parameter expression="${graph.executeDot}" default-value="true"
209      */
210     private boolean executeDot;
211 
212     /**
213      * <p>
214      * If true, the Maven build will continue even if the "dot" executable returns a non-zero exit value.
215      * </p>
216      *
217      * @parameter expression="${graph.ignoreDotFailure}" default-value="false"
218      */
219     private boolean ignoreDotFailure;
220 
221     /**
222      * <p>
223      * If true, skip invoking Graphviz if there are no dependencies to graph.
224      * </p>
225      *
226      * @parameter expression="${graph.skipEmptyGraphs}" default-value="true"
227      */
228     private boolean skipEmptyGraphs;
229 
230     public String getTitle() {
231         return title;
232     }
233 
234     public void setTitle(String title) {
235         this.title = title;
236     }
237 
238     public boolean isKeepDotFile() {
239         return keepDotFile;
240     }
241 
242     public void setKeepDotFile(boolean keepDotFile) {
243         this.keepDotFile = keepDotFile;
244     }
245 
246     public Direction getDirection() {
247         return direction;
248     }
249 
250     public void setDirection(Direction direction) {
251         this.direction = direction;
252     }
253 
254     public boolean isShowGroupIds() {
255         return showGroupIds;
256     }
257 
258     public void setShowGroupIds(boolean showGroupIds) {
259         this.showGroupIds = showGroupIds;
260     }
261 
262     public boolean isShowLegend() {
263         return showLegend;
264     }
265 
266     public void setShowLegend(boolean showLegend) {
267         this.showLegend = showLegend;
268     }
269 
270     public boolean isShowTitle() {
271         return showTitle;
272     }
273 
274     public void setShowTitle(boolean showTitle) {
275         this.showTitle = showTitle;
276     }
277 
278     public boolean isExecuteDot() {
279         return executeDot;
280     }
281 
282     public void setExecuteDot(boolean executeDot) {
283         this.executeDot = executeDot;
284     }
285 
286     public boolean isIgnoreDotFailure() {
287         return ignoreDotFailure;
288     }
289 
290     public void setIgnoreDotFailure(boolean ignoreDotFailure) {
291         this.ignoreDotFailure = ignoreDotFailure;
292     }
293 
294     public boolean isShowDuplicates() {
295         return showDuplicates;
296     }
297 
298     public void setShowDuplicates(boolean showDuplicates) {
299         this.showDuplicates = showDuplicates;
300     }
301 
302     public boolean isCascadeOptional() {
303         return cascadeOptional;
304     }
305 
306     public void setCascadeOptional(boolean cascadeOptional) {
307         this.cascadeOptional = cascadeOptional;
308     }
309 
310     public boolean isSkipEmptyGraphs() {
311         return skipEmptyGraphs;
312     }
313 
314     public void setSkipEmptyGraphs(boolean skipEmptyGraphs) {
315         this.skipEmptyGraphs = skipEmptyGraphs;
316     }
317 
318     public Display getDisplay() {
319         return display;
320     }
321 
322     public void setDisplay(Display filterType) {
323         this.display = filterType;
324     }
325 
326     public Conflicts getConflicts() {
327         return conflicts;
328     }
329 
330     public void setConflicts(Conflicts conflicts) {
331         this.conflicts = conflicts;
332     }
333 
334     public boolean isShowArtifactIds() {
335         return showArtifactIds;
336     }
337 
338     public void setShowArtifactIds(boolean showArtifactIds) {
339         this.showArtifactIds = showArtifactIds;
340     }
341 
342     public boolean isShowVersions() {
343         return showVersions;
344     }
345 
346     public void setShowVersions(boolean showVersions) {
347         this.showVersions = showVersions;
348     }
349 
350     public boolean isShowClassifiers() {
351         return showClassifiers;
352     }
353 
354     public void setShowClassifiers(boolean showClassifiers) {
355         this.showClassifiers = showClassifiers;
356     }
357 
358     public boolean isShowTypes() {
359         return showTypes;
360     }
361 
362     public void setShowTypes(boolean showTypes) {
363         this.showTypes = showTypes;
364     }
365 
366 }