Coverage Report - org.apache.maven.report.projectinfo.HelpMojo
 
Classes in this File Line Coverage Branch Coverage Complexity
HelpMojo
0%
0/246
0%
0/158
8.667
 
 1  
 package org.apache.maven.report.projectinfo;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.Iterator;
 5  
 import java.util.List;
 6  
 
 7  
 import org.apache.maven.plugin.AbstractMojo;
 8  
 import org.apache.maven.plugin.MojoExecutionException;
 9  
 
 10  
 /**
 11  
  * Display help information on maven-project-info-reports-plugin.<br/> Call <pre>  mvn project-info-reports:help -Ddetail=true -Dgoal=&lt;goal-name&gt;</pre> to display parameter details.
 12  
  *
 13  
  * @version generated on Sat May 15 23:36:32 CEST 2010
 14  
  * @author org.apache.maven.tools.plugin.generator.PluginHelpGenerator (version 2.5.1)
 15  
  * @goal help
 16  
  * @requiresProject false
 17  
  */
 18  0
 public class HelpMojo
 19  
     extends AbstractMojo
 20  
 {
 21  
     /**
 22  
      * If <code>true</code>, display all settable properties for each goal.
 23  
      * 
 24  
      * @parameter expression="${detail}" default-value="false"
 25  
      */
 26  
     private boolean detail;
 27  
 
 28  
     /**
 29  
      * The name of the goal for which to show help. If unspecified, all goals will be displayed.
 30  
      * 
 31  
      * @parameter expression="${goal}"
 32  
      */
 33  
     private java.lang.String goal;
 34  
 
 35  
     /**
 36  
      * The maximum length of a display line, should be positive.
 37  
      * 
 38  
      * @parameter expression="${lineLength}" default-value="80"
 39  
      */
 40  
     private int lineLength;
 41  
 
 42  
     /**
 43  
      * The number of spaces per indentation level, should be positive.
 44  
      * 
 45  
      * @parameter expression="${indentSize}" default-value="2"
 46  
      */
 47  
     private int indentSize;
 48  
 
 49  
 
 50  
     /** {@inheritDoc} */
 51  
     public void execute()
 52  
         throws MojoExecutionException
 53  
     {
 54  0
         if ( lineLength <= 0 )
 55  
         {
 56  0
             getLog().warn( "The parameter 'lineLength' should be positive, using '80' as default." );
 57  0
             lineLength = 80;
 58  
         }
 59  0
         if ( indentSize <= 0 )
 60  
         {
 61  0
             getLog().warn( "The parameter 'indentSize' should be positive, using '2' as default." );
 62  0
             indentSize = 2;
 63  
         }
 64  
 
 65  0
         StringBuffer sb = new StringBuffer();
 66  
 
 67  0
         append( sb, "org.apache.maven.plugins:maven-project-info-reports-plugin:2.2", 0 );
 68  0
         append( sb, "", 0 );
 69  
 
 70  0
         append( sb, "Maven Project Info Reports Plugin", 0 );
 71  0
         append( sb, "The Maven Project Info Reports Plugin is a plugin that generates standard reports for the specified project.", 1 );
 72  0
         append( sb, "", 0 );
 73  
 
 74  0
         if ( goal == null || goal.length() <= 0 )
 75  
         {
 76  0
             append( sb, "This plugin has 15 goals:", 0 );
 77  0
             append( sb, "", 0 );
 78  
         }
 79  
 
 80  0
         if ( goal == null || goal.length() <= 0 || "cim".equals( goal ) )
 81  
         {
 82  0
             append( sb, "project-info-reports:cim", 0 );
 83  0
             append( sb, "Generates the Project Continuous Integration System report.", 1 );
 84  0
             append( sb, "", 0 );
 85  0
             if ( detail )
 86  
             {
 87  0
                 append( sb, "Available parameters:", 1 );
 88  0
                 append( sb, "", 0 );
 89  
 
 90  0
                 append( sb, "outputDirectory", 2 );
 91  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 92  0
                 append( sb, "", 0 );
 93  
             }
 94  
         }
 95  
 
 96  0
         if ( goal == null || goal.length() <= 0 || "dependencies".equals( goal ) )
 97  
         {
 98  0
             append( sb, "project-info-reports:dependencies", 0 );
 99  0
             append( sb, "Generates the Project Dependencies report.", 1 );
 100  0
             append( sb, "", 0 );
 101  0
             if ( detail )
 102  
             {
 103  0
                 append( sb, "Available parameters:", 1 );
 104  0
                 append( sb, "", 0 );
 105  
 
 106  0
                 append( sb, "dependencyDetailsEnabled (Default: true)", 2 );
 107  0
                 append( sb, "Display file details for each dependency, such as: file size, number of classes, number of packages etc.", 3 );
 108  0
                 append( sb, "", 0 );
 109  
 
 110  0
                 append( sb, "dependencyLocationsEnabled (Default: true)", 2 );
 111  0
                 append( sb, "Display the repository locations of the dependencies. If Maven is configured to be offline, this parameter will be ignored.", 3 );
 112  0
                 append( sb, "", 0 );
 113  
 
 114  0
                 append( sb, "outputDirectory", 2 );
 115  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 116  0
                 append( sb, "", 0 );
 117  
             }
 118  
         }
 119  
 
 120  0
         if ( goal == null || goal.length() <= 0 || "dependency-convergence".equals( goal ) )
 121  
         {
 122  0
             append( sb, "project-info-reports:dependency-convergence", 0 );
 123  0
             append( sb, "Generates the Dependency Convergence report for reactor builds.", 1 );
 124  0
             append( sb, "", 0 );
 125  0
             if ( detail )
 126  
             {
 127  0
                 append( sb, "Available parameters:", 1 );
 128  0
                 append( sb, "", 0 );
 129  
 
 130  0
                 append( sb, "outputDirectory", 2 );
 131  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 132  0
                 append( sb, "", 0 );
 133  
             }
 134  
         }
 135  
 
 136  0
         if ( goal == null || goal.length() <= 0 || "dependency-management".equals( goal ) )
 137  
         {
 138  0
             append( sb, "project-info-reports:dependency-management", 0 );
 139  0
             append( sb, "Generates the Project Dependency Management report.", 1 );
 140  0
             append( sb, "", 0 );
 141  0
             if ( detail )
 142  
             {
 143  0
                 append( sb, "Available parameters:", 1 );
 144  0
                 append( sb, "", 0 );
 145  
 
 146  0
                 append( sb, "outputDirectory", 2 );
 147  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 148  0
                 append( sb, "", 0 );
 149  
 
 150  0
                 append( sb, "remoteRepositories", 2 );
 151  0
                 append( sb, "Remote repositories used for the project.", 3 );
 152  0
                 append( sb, "", 0 );
 153  
             }
 154  
         }
 155  
 
 156  0
         if ( goal == null || goal.length() <= 0 || "help".equals( goal ) )
 157  
         {
 158  0
             append( sb, "project-info-reports:help", 0 );
 159  0
             append( sb, "Display help information on maven-project-info-reports-plugin.\nCall\n\u00a0\u00a0mvn\u00a0project-info-reports:help\u00a0-Ddetail=true\u00a0-Dgoal=<goal-name>\nto display parameter details.", 1 );
 160  0
             append( sb, "", 0 );
 161  0
             if ( detail )
 162  
             {
 163  0
                 append( sb, "Available parameters:", 1 );
 164  0
                 append( sb, "", 0 );
 165  
 
 166  0
                 append( sb, "detail (Default: false)", 2 );
 167  0
                 append( sb, "If true, display all settable properties for each goal.", 3 );
 168  0
                 append( sb, "", 0 );
 169  
 
 170  0
                 append( sb, "goal", 2 );
 171  0
                 append( sb, "The name of the goal for which to show help. If unspecified, all goals will be displayed.", 3 );
 172  0
                 append( sb, "", 0 );
 173  
 
 174  0
                 append( sb, "indentSize (Default: 2)", 2 );
 175  0
                 append( sb, "The number of spaces per indentation level, should be positive.", 3 );
 176  0
                 append( sb, "", 0 );
 177  
 
 178  0
                 append( sb, "lineLength (Default: 80)", 2 );
 179  0
                 append( sb, "The maximum length of a display line, should be positive.", 3 );
 180  0
                 append( sb, "", 0 );
 181  
             }
 182  
         }
 183  
 
 184  0
         if ( goal == null || goal.length() <= 0 || "index".equals( goal ) )
 185  
         {
 186  0
             append( sb, "project-info-reports:index", 0 );
 187  0
             append( sb, "Generates the project index page.", 1 );
 188  0
             append( sb, "", 0 );
 189  0
             if ( detail )
 190  
             {
 191  0
                 append( sb, "Available parameters:", 1 );
 192  0
                 append( sb, "", 0 );
 193  
 
 194  0
                 append( sb, "outputDirectory", 2 );
 195  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 196  0
                 append( sb, "", 0 );
 197  
             }
 198  
         }
 199  
 
 200  0
         if ( goal == null || goal.length() <= 0 || "issue-tracking".equals( goal ) )
 201  
         {
 202  0
             append( sb, "project-info-reports:issue-tracking", 0 );
 203  0
             append( sb, "Generates the Project Issue Tracking report.", 1 );
 204  0
             append( sb, "", 0 );
 205  0
             if ( detail )
 206  
             {
 207  0
                 append( sb, "Available parameters:", 1 );
 208  0
                 append( sb, "", 0 );
 209  
 
 210  0
                 append( sb, "outputDirectory", 2 );
 211  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 212  0
                 append( sb, "", 0 );
 213  
             }
 214  
         }
 215  
 
 216  0
         if ( goal == null || goal.length() <= 0 || "license".equals( goal ) )
 217  
         {
 218  0
             append( sb, "project-info-reports:license", 0 );
 219  0
             append( sb, "Generates the Project License report.", 1 );
 220  0
             append( sb, "", 0 );
 221  0
             if ( detail )
 222  
             {
 223  0
                 append( sb, "Available parameters:", 1 );
 224  0
                 append( sb, "", 0 );
 225  
 
 226  0
                 append( sb, "offline", 2 );
 227  0
                 append( sb, "Whether the system is currently offline.", 3 );
 228  0
                 append( sb, "", 0 );
 229  
 
 230  0
                 append( sb, "outputDirectory", 2 );
 231  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 232  0
                 append( sb, "", 0 );
 233  
             }
 234  
         }
 235  
 
 236  0
         if ( goal == null || goal.length() <= 0 || "mailing-list".equals( goal ) )
 237  
         {
 238  0
             append( sb, "project-info-reports:mailing-list", 0 );
 239  0
             append( sb, "Generates the Mailing List report.", 1 );
 240  0
             append( sb, "", 0 );
 241  0
             if ( detail )
 242  
             {
 243  0
                 append( sb, "Available parameters:", 1 );
 244  0
                 append( sb, "", 0 );
 245  
 
 246  0
                 append( sb, "introduction", 2 );
 247  0
                 append( sb, "This can override the header text of the mailing list(s) report", 3 );
 248  0
                 append( sb, "", 0 );
 249  
 
 250  0
                 append( sb, "outputDirectory", 2 );
 251  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 252  0
                 append( sb, "", 0 );
 253  
             }
 254  
         }
 255  
 
 256  0
         if ( goal == null || goal.length() <= 0 || "modules".equals( goal ) )
 257  
         {
 258  0
             append( sb, "project-info-reports:modules", 0 );
 259  0
             append( sb, "Generates the Project Modules report.", 1 );
 260  0
             append( sb, "", 0 );
 261  0
             if ( detail )
 262  
             {
 263  0
                 append( sb, "Available parameters:", 1 );
 264  0
                 append( sb, "", 0 );
 265  
 
 266  0
                 append( sb, "outputDirectory", 2 );
 267  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 268  0
                 append( sb, "", 0 );
 269  
             }
 270  
         }
 271  
 
 272  0
         if ( goal == null || goal.length() <= 0 || "plugin-management".equals( goal ) )
 273  
         {
 274  0
             append( sb, "project-info-reports:plugin-management", 0 );
 275  0
             append( sb, "Generates the Project Plugin Management report.", 1 );
 276  0
             append( sb, "", 0 );
 277  0
             if ( detail )
 278  
             {
 279  0
                 append( sb, "Available parameters:", 1 );
 280  0
                 append( sb, "", 0 );
 281  
 
 282  0
                 append( sb, "outputDirectory", 2 );
 283  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 284  0
                 append( sb, "", 0 );
 285  
             }
 286  
         }
 287  
 
 288  0
         if ( goal == null || goal.length() <= 0 || "plugins".equals( goal ) )
 289  
         {
 290  0
             append( sb, "project-info-reports:plugins", 0 );
 291  0
             append( sb, "Generates the Project Plugins report.", 1 );
 292  0
             append( sb, "", 0 );
 293  0
             if ( detail )
 294  
             {
 295  0
                 append( sb, "Available parameters:", 1 );
 296  0
                 append( sb, "", 0 );
 297  
 
 298  0
                 append( sb, "outputDirectory", 2 );
 299  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 300  0
                 append( sb, "", 0 );
 301  
             }
 302  
         }
 303  
 
 304  0
         if ( goal == null || goal.length() <= 0 || "project-team".equals( goal ) )
 305  
         {
 306  0
             append( sb, "project-info-reports:project-team", 0 );
 307  0
             append( sb, "Generates the Project Team report.", 1 );
 308  0
             append( sb, "", 0 );
 309  0
             if ( detail )
 310  
             {
 311  0
                 append( sb, "Available parameters:", 1 );
 312  0
                 append( sb, "", 0 );
 313  
 
 314  0
                 append( sb, "outputDirectory", 2 );
 315  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 316  0
                 append( sb, "", 0 );
 317  
             }
 318  
         }
 319  
 
 320  0
         if ( goal == null || goal.length() <= 0 || "scm".equals( goal ) )
 321  
         {
 322  0
             append( sb, "project-info-reports:scm", 0 );
 323  0
             append( sb, "Generates the Project Source Code Management (SCM) report.", 1 );
 324  0
             append( sb, "", 0 );
 325  0
             if ( detail )
 326  
             {
 327  0
                 append( sb, "Available parameters:", 1 );
 328  0
                 append( sb, "", 0 );
 329  
 
 330  0
                 append( sb, "anonymousConnection (Default: ${project.scm.connection})", 2 );
 331  0
                 append( sb, "The SCM anonymous connection url respecting the SCM URL Format.", 3 );
 332  0
                 append( sb, "", 0 );
 333  
 
 334  0
                 append( sb, "checkoutDirectoryName (Default: ${project.artifactId})", 2 );
 335  0
                 append( sb, "The directory name to checkout right after the SCM URL.", 3 );
 336  0
                 append( sb, "", 0 );
 337  
 
 338  0
                 append( sb, "developerConnection (Default: ${project.scm.developerConnection})", 2 );
 339  0
                 append( sb, "The SCM developer connection url respecting the SCM URL Format.", 3 );
 340  0
                 append( sb, "", 0 );
 341  
 
 342  0
                 append( sb, "outputDirectory", 2 );
 343  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 344  0
                 append( sb, "", 0 );
 345  
 
 346  0
                 append( sb, "webAccessUrl (Default: ${project.scm.url})", 2 );
 347  0
                 append( sb, "The SCM web access url.", 3 );
 348  0
                 append( sb, "", 0 );
 349  
             }
 350  
         }
 351  
 
 352  0
         if ( goal == null || goal.length() <= 0 || "summary".equals( goal ) )
 353  
         {
 354  0
             append( sb, "project-info-reports:summary", 0 );
 355  0
             append( sb, "Generates the project information reports summary.", 1 );
 356  0
             append( sb, "", 0 );
 357  0
             if ( detail )
 358  
             {
 359  0
                 append( sb, "Available parameters:", 1 );
 360  0
                 append( sb, "", 0 );
 361  
 
 362  0
                 append( sb, "outputDirectory", 2 );
 363  0
                 append( sb, "The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from the command line. If the goal is run indirectly as part of a site generation, the output directory configured in the Maven Site Plugin is used instead.", 3 );
 364  0
                 append( sb, "", 0 );
 365  
             }
 366  
         }
 367  
 
 368  0
         if ( getLog().isInfoEnabled() )
 369  
         {
 370  0
             getLog().info( sb.toString() );
 371  
         }
 372  0
     }
 373  
 
 374  
     /**
 375  
      * <p>Repeat a String <code>n</code> times to form a new string.</p>
 376  
      *
 377  
      * @param str String to repeat
 378  
      * @param repeat number of times to repeat str
 379  
      * @return String with repeated String
 380  
      * @throws NegativeArraySizeException if <code>repeat < 0</code>
 381  
      * @throws NullPointerException if str is <code>null</code>
 382  
      */
 383  
     private static String repeat( String str, int repeat )
 384  
     {
 385  0
         StringBuffer buffer = new StringBuffer( repeat * str.length() );
 386  
 
 387  0
         for ( int i = 0; i < repeat; i++ )
 388  
         {
 389  0
             buffer.append( str );
 390  
         }
 391  
 
 392  0
         return buffer.toString();
 393  
     }
 394  
 
 395  
     /** 
 396  
      * Append a description to the buffer by respecting the indentSize and lineLength parameters.
 397  
      * <b>Note</b>: The last character is always a new line.
 398  
      * 
 399  
      * @param sb The buffer to append the description, not <code>null</code>.
 400  
      * @param description The description, not <code>null</code>.
 401  
      * @param indent The base indentation level of each line, must not be negative.
 402  
      */
 403  
     private void append( StringBuffer sb, String description, int indent )
 404  
     {
 405  0
         for ( Iterator it = toLines( description, indent, indentSize, lineLength ).iterator(); it.hasNext(); )
 406  
         {
 407  0
             sb.append( it.next().toString() ).append( '\n' );
 408  
         }
 409  0
     }
 410  
 
 411  
     /** 
 412  
      * Splits the specified text into lines of convenient display length.
 413  
      * 
 414  
      * @param text The text to split into lines, must not be <code>null</code>.
 415  
      * @param indent The base indentation level of each line, must not be negative.
 416  
      * @param indentSize The size of each indentation, must not be negative.
 417  
      * @param lineLength The length of the line, must not be negative.
 418  
      * @return The sequence of display lines, never <code>null</code>.
 419  
      * @throws NegativeArraySizeException if <code>indent < 0</code>
 420  
      */
 421  
     private static List toLines( String text, int indent, int indentSize, int lineLength )
 422  
     {
 423  0
         List lines = new ArrayList();
 424  
 
 425  0
         String ind = repeat( "\t", indent );
 426  0
         String[] plainLines = text.split( "(\r\n)|(\r)|(\n)" );
 427  0
         for ( int i = 0; i < plainLines.length; i++ )
 428  
         {
 429  0
             toLines( lines, ind + plainLines[i], indentSize, lineLength );
 430  
         }
 431  
 
 432  0
         return lines;
 433  
     }
 434  
 
 435  
     /** 
 436  
      * Adds the specified line to the output sequence, performing line wrapping if necessary.
 437  
      * 
 438  
      * @param lines The sequence of display lines, must not be <code>null</code>.
 439  
      * @param line The line to add, must not be <code>null</code>.
 440  
      * @param indentSize The size of each indentation, must not be negative.
 441  
      * @param lineLength The length of the line, must not be negative.
 442  
      */
 443  
     private static void toLines( List lines, String line, int indentSize, int lineLength )
 444  
     {
 445  0
         int lineIndent = getIndentLevel( line );
 446  0
         StringBuffer buf = new StringBuffer( 256 );
 447  0
         String[] tokens = line.split( " +" );
 448  0
         for ( int i = 0; i < tokens.length; i++ )
 449  
         {
 450  0
             String token = tokens[i];
 451  0
             if ( i > 0 )
 452  
             {
 453  0
                 if ( buf.length() + token.length() >= lineLength )
 454  
                 {
 455  0
                     lines.add( buf.toString() );
 456  0
                     buf.setLength( 0 );
 457  0
                     buf.append( repeat( " ", lineIndent * indentSize ) );
 458  
                 }
 459  
                 else
 460  
                 {
 461  0
                     buf.append( ' ' );
 462  
                 }
 463  
             }
 464  0
             for ( int j = 0; j < token.length(); j++ )
 465  
             {
 466  0
                 char c = token.charAt( j );
 467  0
                 if ( c == '\t' )
 468  
                 {
 469  0
                     buf.append( repeat( " ", indentSize - buf.length() % indentSize ) );
 470  
                 }
 471  0
                 else if ( c == '\u00A0' )
 472  
                 {
 473  0
                     buf.append( ' ' );
 474  
                 }
 475  
                 else
 476  
                 {
 477  0
                     buf.append( c );
 478  
                 }
 479  
             }
 480  
         }
 481  0
         lines.add( buf.toString() );
 482  0
     }
 483  
 
 484  
     /** 
 485  
      * Gets the indentation level of the specified line.
 486  
      * 
 487  
      * @param line The line whose indentation level should be retrieved, must not be <code>null</code>.
 488  
      * @return The indentation level of the line.
 489  
      */
 490  
     private static int getIndentLevel( String line )
 491  
     {
 492  0
         int level = 0;
 493  0
         for ( int i = 0; i < line.length() && line.charAt( i ) == '\t'; i++ )
 494  
         {
 495  0
             level++;
 496  
         }
 497  0
         for ( int i = level + 1; i <= level + 4 && i < line.length(); i++ )
 498  
         {
 499  0
             if ( line.charAt( i ) == '\t' )
 500  
             {
 501  0
                 level++;
 502  0
                 break;
 503  
             }
 504  
         }
 505  0
         return level;
 506  
     }
 507  
 }