o Getting rid of java and using jelly as we need this as part of

the bootstrap.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112894 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jvanzyl 2003-02-11 04:07:53 +00:00
parent 5c5a3524e1
commit bde753eac1
3 changed files with 6 additions and 252 deletions

View File

@ -9,12 +9,6 @@
<define:taglib uri="license">
<!--
<define:jellybean name="license"
className="org.apache.maven.license.LicenseTask"
method="doExecute" />
-->
<define:tag name="fileName">
<j:set var="licenseX" value='${maven.license.licenseFile}X'/>
@ -95,16 +89,10 @@
</echo>
<j:set var="licenseFile" value='${plugin.resources}/LICENSE.txt'/>
</j:if>
<!--
<license:license
description="Project License"
input="${licenseFile}"
output="${genDocs}/license.xml"
outputEncoding="${pom.getPluginContext('maven-xdoc-plugin').getVariable('maven.docs.outputencoding')}"
title="License"
/>
-->
<j:file name="${genDocs}/license.xml" prettyPrint="true" xmlns="dummy">
<j:include file="${plugin.resources}/license.xml"/>
</j:file>
</goal>

View File

@ -1,233 +0,0 @@
package org.apache.maven.license;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Maven" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Maven", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
// java imports
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
/**
* This task generates an xdoc formatted file from an input text file
* provided.
*
* @author <a href="mailto:mmay@javafreedom.org">Markus M. May</a>
* @author <a href="mailto:dion@multitask.com.au">dIon Gillard</a>
* @version $Id: LicenseTask.java,v 1.2 2003/02/07 11:47:14 evenisse Exp $
*/
public class LicenseTask
{
/** The input file */
private File input;
/** Output file for xml document */
private File output;
/** title of the resulting document */
private String title = "";
/** description of the resulting document */
private String description = "";
/** output encoding for the xml document */
private String outputEncoding = "ISO-8859-1";
/**
* Output file for xml document
*/
public File getOutput()
{
return output;
}
/**
* Set the output file for the log.
* @param output the output file
*/
public void setOutput(File aFile)
{
output = aFile;
}
public File getInput()
{
return input;
}
public void setInput(File aFile)
{
input = aFile;
}
/**
* Execute task.
* @throws FileNotFoundException if {@link #getInput()} doesn't exist
* @throws UnsupportedEncodingException if the underlying platform doesn't
* support ISO-8859-1 encoding
*/
public void doExecute() throws FileNotFoundException, IOException,
UnsupportedEncodingException
{
if (output == null)
{
throw new NullPointerException("output must be set");
}
if (input == null)
{
throw new NullPointerException("input must be set");
}
if (!input.exists() || !input.canRead())
{
throw new IOException("cannot read license file");
}
File dir = output.getParentFile();
if (dir != null) {
dir.mkdirs();
}
PrintWriter out = new PrintWriter(new OutputStreamWriter(
new FileOutputStream(output), getOutputEncoding()));
out.print("<?xml version=\"1.0\" encoding=\"");
out.print(getOutputEncoding());
out.println("\" ?>");
out.println("<document>");
out.print("<properties><title>");
out.print(getTitle());
out.println("</title></properties>");
out.println("<body>");
out.print("<section name=\"");
out.print(getDescription());
out.println("\">");
out.println("<source><![CDATA[");
FileInputStream fileInput = new FileInputStream(input);
BufferedReader data = new BufferedReader(
new InputStreamReader(fileInput));
char[] buffer = new char[512];
int length = 0;
while ((length = data.read(buffer, 0, buffer.length)) != -1)
{
out.write(buffer, 0, length);
}
out.println("]]></source>");
out.println("</section>");
out.println("</body>");
out.println("</document>");
out.flush();
out.close();
}
/**
* Returns the description.
* @return String
*/
public String getDescription()
{
return description;
}
/**
* Returns the title.
* @return String
*/
public String getTitle()
{
return title;
}
/**
* Sets the description.
* @param description The new description
*/
public void setDescription(String description)
{
this.description = description;
}
/**
* Sets the title.
* @param title The new title
*/
public void setTitle(String title)
{
this.title = title;
}
/**
* Returns the outputEncoding.
* @return String
*/
public String getOutputEncoding()
{
return outputEncoding;
}
/**
* Sets the outputEncoding.
* @param outputEncoding The outputEncoding to set
*/
public void setOutputEncoding(String outputEncoding)
{
this.outputEncoding = outputEncoding;
}
}

View File

@ -2,12 +2,11 @@
<document>
<properties>
<author email="${authorEmail}">${author}</author>
<title>${title}</title>
<title>License</title>
</properties>
<body>
<section name="">
<section name="License">
<source><![CDATA[
${licenseText}
]]></source>