Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.apache.maven.plugins.help;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
  * regarding copyright ownership.  The ASF licenses this file
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
Base class with some Help Mojo functionalities.

Author(s):
Vincent Siveton
Version:
$Id: AbstractHelpMojo.java 689770 2008-08-28 09:47:18Z vsiveton $
Since:
2.1
public abstract class AbstractHelpMojo
    extends AbstractMojo
{
    
The maximum length of a display line.
    protected static final int LINE_LENGTH = 79;

    
Optional parameter to write the output of this help in a given file, instead of writing to the console.
Note: Could be a relative path.

Parameter:
expression="${output}"
    protected File output;

    
Utility method to write a content in a given file.

Parameters:
output is the wanted output file.
content contains the content to be written to the file.
Throws:
java.io.IOException if any
See also:
writeFile(java.io.File,java.lang.String)
    protected static void writeFileFile outputStringBuffer content )
        throws IOException
    {
        writeFileoutputcontent.toString() );
    }

    
Utility method to write a content in a given file.

Parameters:
output is the wanted output file.
content contains the content to be written to the file.
Throws:
java.io.IOException if any
    protected static void writeFileFile outputString content )
        throws IOException
    {
        if ( output == null )
        {
            return;
        }
        Writer out = null;
        try
        {
            output.getParentFile().mkdirs();
            out = WriterFactory.newPlatformWriteroutput );
            out.writecontent );
            out.flush();
        }
        finally
        {
            IOUtil.closeout );
        }
    }
New to GrepCode? Check out our FAQ X