MPLUGIN-81: Handle Mojo annotations as Javadoc taglets to make better javadoc
o added new project git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@632196 13f79535-47bb-0310-9956-ffa450edef68master
parent
dc54ef0aa5
commit
af1dd6b0a9
|
|
@ -0,0 +1,147 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>maven-plugin-tools</artifactId>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<version>2.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>maven-plugin-tools-javadoc</artifactId>
|
||||
<name>Maven Plugin Tools Javadoc</name>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<inceptionYear>2008</inceptionYear>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-java</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>default-tools.jar</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>java.vendor</name>
|
||||
<value>Sun Microsystems Inc.</value>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sun</groupId>
|
||||
<artifactId>tools</artifactId>
|
||||
<version>1.4.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${java.home}/../lib/tools.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>integration-tests</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>maven.test.skip</name>
|
||||
<value>!true</value>
|
||||
</property>
|
||||
</activation>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-plugin-testing-harness</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-alpha-9</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>it-test</id>
|
||||
<phase>process-test-classes</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>it-test</id>
|
||||
<phase>process-test-classes</phase>
|
||||
<goals>
|
||||
<goal>install-file</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<file>${project.build.directory}/${project.build.finalName}.jar</file>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<packaging>${project.packaging}</packaging>
|
||||
<pomFile>${basedir}/pom.xml</pomFile>
|
||||
<createChecksum>true</createChecksum>
|
||||
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
|
||||
<localRepositoryId>it-local-repo</localRepositoryId>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract <code>Taglet</code> for annotations specified at the Mojo parameter level.
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class AbstractMojoFieldTaglet
|
||||
extends AbstractMojoTaglet
|
||||
{
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in constructor documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inConstructor()
|
||||
*/
|
||||
public final boolean inConstructor()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> since this annotation can <b>NOT</b> be used in field documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inField()
|
||||
*/
|
||||
public final boolean inField()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in method documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inMethod()
|
||||
*/
|
||||
public final boolean inMethod()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in overview documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inOverview()
|
||||
*/
|
||||
public final boolean inOverview()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in package documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inPackage()
|
||||
*/
|
||||
public final boolean inPackage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can be used in type documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inType()
|
||||
*/
|
||||
public final boolean inType()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in inline tag.
|
||||
* @see com.sun.tools.doclets.Taglet#isInlineTag()
|
||||
*/
|
||||
public final boolean isInlineTag()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,425 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.swing.text.AttributeSet;
|
||||
import javax.swing.text.MutableAttributeSet;
|
||||
import javax.swing.text.SimpleAttributeSet;
|
||||
|
||||
import com.sun.javadoc.Tag;
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* Abstract <code>Taglet</code> for <a href="http://maven.codehaus.org/"/>Maven</a> Mojo annotations.
|
||||
* <br/>
|
||||
* A Mojo annotation is defined like the following:
|
||||
* <pre>
|
||||
* @annotation <annotationValue> <parameterName="parameterValue">
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class AbstractMojoTaglet
|
||||
implements Taglet
|
||||
{
|
||||
/** {@inheritDoc} */
|
||||
public String toString( Tag tag )
|
||||
{
|
||||
if ( tag == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
String tagValue = getTagValue( tag );
|
||||
MutableAttributeSet tagAttributes = getTagAttributes( tag );
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
appendTag( sb, tag, tagAttributes, tagValue );
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public String toString( Tag[] tags )
|
||||
{
|
||||
if ( tags.length == 0 )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for ( int i = 0; i < tags.length; i++ )
|
||||
{
|
||||
String tagValue = getTagValue( tags[i] );
|
||||
MutableAttributeSet tagAttributes = getTagAttributes( tags[i] );
|
||||
|
||||
appendTag( sb, tags[i], tagAttributes, tagValue );
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the header, i.e. the message, to display
|
||||
*/
|
||||
public abstract String getHeader();
|
||||
|
||||
/**
|
||||
* @return the given annotation value, or <code>null</code> if the given Mojo annotation/tag does't allow
|
||||
* annotation value.
|
||||
* <br/>
|
||||
* <b>Note</b>: the value could be a pattern value, i.e.: <code>*</code> for every values, <code>a|b|c</code>
|
||||
* for <code>a OR b OR c</code>.
|
||||
*/
|
||||
public abstract String getAllowedValue();
|
||||
|
||||
/**
|
||||
* @return an array of the allowed parameter names for the given Mojo annotation/tag, or <code>null</code>
|
||||
* if the annotation/tag doesn't allow parameter.
|
||||
*/
|
||||
public abstract String[] getAllowedParameterNames();
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if taglet has annotation value, <code>false</code> otherwise.
|
||||
* @see #getAllowedValue()
|
||||
*/
|
||||
public boolean hasAnnotationValue()
|
||||
{
|
||||
return getAllowedValue() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> if taglet has parameters, <code>false</code> otherwise.
|
||||
* @see #getAllowedParameterNames()
|
||||
*/
|
||||
public boolean hasAnnotationParameters()
|
||||
{
|
||||
return getAllowedParameterNames() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tag not null.
|
||||
* @return a not null String or <code>null</code> if no annotation value was found.
|
||||
*/
|
||||
private String getTagValue( Tag tag )
|
||||
{
|
||||
if ( tag == null )
|
||||
{
|
||||
throw new IllegalArgumentException( "tag should be not null" );
|
||||
}
|
||||
|
||||
String text = tag.text();
|
||||
if ( isEmpty( text ) )
|
||||
{
|
||||
// using pattern: @annotation
|
||||
return null;
|
||||
}
|
||||
|
||||
String tagValue = null;
|
||||
StringTokenizer token = new StringTokenizer( text, " " );
|
||||
while ( token.hasMoreTokens() )
|
||||
{
|
||||
String nextToken = token.nextToken();
|
||||
|
||||
if ( nextToken.indexOf( "=" ) == -1 )
|
||||
{
|
||||
// using pattern: @annotation <annotationValue>
|
||||
tagValue = nextToken;
|
||||
}
|
||||
}
|
||||
|
||||
return tagValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tag not null.
|
||||
* @return a not null MutableAttributeSet.
|
||||
*/
|
||||
private MutableAttributeSet getTagAttributes( Tag tag )
|
||||
{
|
||||
if ( tag == null )
|
||||
{
|
||||
throw new IllegalArgumentException( "tag should be not null" );
|
||||
}
|
||||
|
||||
String text = tag.text();
|
||||
|
||||
StringTokenizer token = new StringTokenizer( text, " " );
|
||||
MutableAttributeSet tagAttributes = new SimpleAttributeSet();
|
||||
while ( token.hasMoreTokens() )
|
||||
{
|
||||
String nextToken = token.nextToken();
|
||||
|
||||
if ( nextToken.indexOf( "=" ) == -1 )
|
||||
{
|
||||
// using pattern: @annotation <annotationValue>
|
||||
continue;
|
||||
}
|
||||
|
||||
StringTokenizer token2 = new StringTokenizer( nextToken, "=" );
|
||||
if ( token2.countTokens() != 2 )
|
||||
{
|
||||
System.err.println( "The annotation '" + tag.name() + "' has no name/value pairs parameter: "
|
||||
+ tag.name() + " " + text + " (" + tag.position().file() + ":" + tag.position().line() + ":"
|
||||
+ tag.position().column() + ")" );
|
||||
tagAttributes.addAttribute( token2.nextToken(), "" );
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = token2.nextToken();
|
||||
String value = token2.nextToken().replace( "\"", "" );
|
||||
|
||||
if ( getAllowedParameterNames() != null && !Arrays.asList( getAllowedParameterNames() ).contains( name ) )
|
||||
{
|
||||
System.err.println( "The annotation '" + tag.name() + "' has wrong parameter name: " + tag.name() + " "
|
||||
+ text + " (" + tag.position().file() + ":" + tag.position().line() + ":" + tag.position().column()
|
||||
+ ")" );
|
||||
}
|
||||
|
||||
tagAttributes.addAttribute( name, value );
|
||||
}
|
||||
|
||||
return tagAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a tag
|
||||
*
|
||||
* @param sb
|
||||
* @param tag
|
||||
* @param tagAttributes
|
||||
* @param tagValue
|
||||
*/
|
||||
private void appendTag( StringBuffer sb, Tag tag, MutableAttributeSet tagAttributes, String tagValue )
|
||||
{
|
||||
if ( !hasAnnotationParameters() )
|
||||
{
|
||||
if ( tagAttributes.getAttributeCount() > 0 )
|
||||
{
|
||||
System.err.println( "The annotation '@" + getName() + "' should have no attribute ("
|
||||
+ tag.position().file() + ":" + tag.position().line() + ":" + tag.position().column() + ")" );
|
||||
}
|
||||
|
||||
if ( hasAnnotationValue() )
|
||||
{
|
||||
sb.append( "<DT><B>" ).append( getHeader() ).append( ":</B></DT>" );
|
||||
if ( isEveryValues( getAllowedValue() ) )
|
||||
{
|
||||
if ( isNotEmpty( tagValue ) )
|
||||
{
|
||||
sb.append( "<DD>" ).append( tagValue ).append( "</DD>" );
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println( "The annotation '@" + getName() + "' is specified to have a value but "
|
||||
+ "no value is defined (" + tag.position().file() + ":" + tag.position().line() + ":"
|
||||
+ tag.position().column() + ")" );
|
||||
sb.append( "<DD>" ).append( "NOT DEFINED" ).append( "</DD>" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List l = getOnlyValues( getAllowedValue() );
|
||||
if ( isNotEmpty( tagValue ) )
|
||||
{
|
||||
if ( l.contains( tagValue ) )
|
||||
{
|
||||
sb.append( "<DD>" ).append( tagValue ).append( "</DD>" );
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println( "The annotation '@" + getName() + "' is specified to be a value of "
|
||||
+ l + " (" + tag.position().file() + ":" + tag.position().line() + ":"
|
||||
+ tag.position().column() + ")" );
|
||||
sb.append( "<DD>" ).append( tagValue ).append( "</DD>" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append( "<DD>" ).append( l.get( 0 ) ).append( "</DD>" );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isNotEmpty( tagValue ) )
|
||||
{
|
||||
System.err.println( "The annotation '@" + getName() + "' should have no value ("
|
||||
+ tag.position().file() + ":" + tag.position().line() + ":" + tag.position().column() + ")" );
|
||||
}
|
||||
sb.append( "<DT><B>" ).append( getHeader() ).append( "</B></DT>" );
|
||||
sb.append( "<DD></DD>" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( hasAnnotationValue() )
|
||||
{
|
||||
sb.append( "<DT><B>" ).append( getHeader() ).append( ":</B></DT>" );
|
||||
if ( isEveryValues( getAllowedValue() ) )
|
||||
{
|
||||
if ( isNotEmpty( tagValue ) )
|
||||
{
|
||||
sb.append( "<DD>" ).append( tagValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println( "The annotation '@" + getName() + "' is specified to have a value but "
|
||||
+ "no value is defined (" + tag.position().file() + ":" + tag.position().line() + ":"
|
||||
+ tag.position().column() + ")" );
|
||||
sb.append( "<DD>" ).append( "NOT DEFINED" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
List l = getOnlyValues( getAllowedValue() );
|
||||
if ( isNotEmpty( tagValue ) )
|
||||
{
|
||||
if ( l.contains( tagValue ) )
|
||||
{
|
||||
sb.append( "<DD>" ).append( tagValue );
|
||||
}
|
||||
else
|
||||
{
|
||||
System.err.println( "The annotation '@" + getName() + "' is specified to be a value in "
|
||||
+ l + " (" + tag.position().file() + ":" + tag.position().line() + ":"
|
||||
+ tag.position().column() + ")" );
|
||||
sb.append( "<DD>" ).append( tagValue );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append( "<DD>" ).append( l.get( 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isNotEmpty( tagValue ) )
|
||||
{
|
||||
System.err.println( "The annotation '@" + getName() + "' should have no value ("
|
||||
+ tag.position().file() + ":" + tag.position().line() + ":" + tag.position().column() + ")" );
|
||||
}
|
||||
sb.append( "<DT><B>" ).append( getHeader() ).append( ":</B></DT>" );
|
||||
sb.append( "<DD>" );
|
||||
}
|
||||
|
||||
appendAnnotationParameters( sb, tagAttributes );
|
||||
sb.append( "</DD>" );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Append the annotation parameters as a definition list.
|
||||
*
|
||||
* @param sb not null
|
||||
* @param att not null
|
||||
*/
|
||||
private static void appendAnnotationParameters( StringBuffer sb, MutableAttributeSet att )
|
||||
{
|
||||
sb.append( "<DL>" );
|
||||
|
||||
Enumeration names = att.getAttributeNames();
|
||||
while ( names.hasMoreElements() )
|
||||
{
|
||||
Object key = names.nextElement();
|
||||
Object value = att.getAttribute( key );
|
||||
|
||||
if ( value instanceof AttributeSet )
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append( "<DT><B>" ).append( key ).append( ":</B></DT>" );
|
||||
sb.append( "<DD>" ).append( value ).append( "</DD>" );
|
||||
}
|
||||
}
|
||||
|
||||
sb.append( "</DL>" );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param text not null
|
||||
* @return <code>true</code> if text contains <code>*</code>, <code>false</code> otherwise.
|
||||
*/
|
||||
private static boolean isEveryValues( String text )
|
||||
{
|
||||
return text.trim().equals( "*" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits the provided text into a array, using pipe as the separator.
|
||||
*
|
||||
* @param text not null
|
||||
* @return a list of parsed Strings or <code>Collections.EMPTY_LIST</code>. By convention, the default value is the first element.
|
||||
*/
|
||||
private static List getOnlyValues( String text )
|
||||
{
|
||||
if ( text.indexOf( "|" ) == -1 )
|
||||
{
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
List l = new ArrayList();
|
||||
StringTokenizer token = new StringTokenizer( text, "|" );
|
||||
while ( token.hasMoreTokens() )
|
||||
{
|
||||
l.add( token.nextToken() );
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Checks if a String is non <code>null</code> and is
|
||||
* not empty (<code>length > 0</code>).</p>
|
||||
*
|
||||
* @param str the String to check
|
||||
* @return true if the String is non-null, and not length zero
|
||||
*/
|
||||
private static boolean isNotEmpty( String str )
|
||||
{
|
||||
return ( str != null && str.length() > 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Checks if a (trimmed) String is <code>null</code> or empty.</p>
|
||||
*
|
||||
* @param str the String to check
|
||||
* @return <code>true</code> if the String is <code>null</code>, or
|
||||
* length zero once trimmed
|
||||
*/
|
||||
private static boolean isEmpty( String str )
|
||||
{
|
||||
return ( str == null || str.trim().length() == 0 );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract <code>Taglet</code> for annotations specified at the Mojo class level.
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class AbstractMojoTypeTaglet
|
||||
extends AbstractMojoTaglet
|
||||
{
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in constructor documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inConstructor()
|
||||
*/
|
||||
public final boolean inConstructor()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in field documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inField()
|
||||
*/
|
||||
public final boolean inField()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in method documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inMethod()
|
||||
*/
|
||||
public final boolean inMethod()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in overview documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inOverview()
|
||||
*/
|
||||
public final boolean inOverview()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in package documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inPackage()
|
||||
*/
|
||||
public final boolean inPackage()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true</code> since this annotation can be used in type documentation.
|
||||
* @see com.sun.tools.doclets.Taglet#inType()
|
||||
*/
|
||||
public final boolean inType()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false</code> since this annotation can <b>NOT</b> be used in inline tag.
|
||||
* @see com.sun.tools.doclets.Taglet#isInlineTag()
|
||||
*/
|
||||
public final boolean isInlineTag()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@aggregator</tt> tag is used to aggregate the Maven project and its child modules and
|
||||
* has no parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @aggregator
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'aggregator:t:Aggregates the Maven project and its child modules.'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoAggregatorTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.AGGREGATOR;
|
||||
|
||||
protected static final String HEADER = "Aggregates the Maven project and its child modules.";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@aggregator</code> has no value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@aggregator</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoAggregatorTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoAggregatorTypeTaglet tag = new MojoAggregatorTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@parameter</tt> tag is used to populate Plexus component and has annotation parameters.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* public class MyMojo extends AbstractMojo
|
||||
* {
|
||||
* /**
|
||||
*  * Dummy parameter.
|
||||
*  *
|
||||
*  * @component <role="..."> <roleHint="...">
|
||||
*  * ...
|
||||
*  */
|
||||
* private Object parameterName;
|
||||
* }
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoComponentFieldTaglet
|
||||
extends AbstractMojoFieldTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.COMPONENT;
|
||||
|
||||
private static final String[] COMPONENTS_NAME = {
|
||||
JavaMojoAnnotation.COMPONENT_ROLE,
|
||||
JavaMojoAnnotation.COMPONENT_ROLEHINT };
|
||||
|
||||
protected static final String HEADER = "Is a Plexus component defined by";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@component</code> has no value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>MojoComponentFieldTaglet#COMPONENTS_NAME</code> since <code>@component</code> has parameters.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return COMPONENTS_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoComponentFieldTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoComponentFieldTaglet tag = new MojoComponentFieldTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@configurator</tt> tag is used to inject parameter values into the Mojo and has annotation parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @configurator <roleHint>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'configurator:t:Is configured to the role hint:'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoConfiguratorTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.CONFIGURATOR;
|
||||
|
||||
protected static final String HEADER = "Is configured to the role hint";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>"*"</code> since <code>@configurator</code> has a value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "*";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@configurator</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoConfiguratorTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoConfiguratorTypeTaglet tag = new MojoConfiguratorTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@execute</tt> tag is used to reference the invocation way of the Mojo and has parameters.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @execute phase="..." lifecycle="..."
|
||||
*  * <OR>
|
||||
*  * @execute phase="..."
|
||||
*  * <OR>
|
||||
*  * @execute goal="..."
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoExecuteTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.EXECUTE;
|
||||
|
||||
private static final String[] PARAMETERS_NAME = {
|
||||
JavaMojoAnnotation.EXECUTE_PHASE,
|
||||
JavaMojoAnnotation.EXECUTE_LIFECYCLE,
|
||||
JavaMojoAnnotation.EXECUTE_GOAL };
|
||||
|
||||
protected static final String HEADER = "Is defined to be executed in";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@execute</code> has no value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>MojoExecuteTypeTaglet#PARAMETERS_NAME</code> since <code>@execute</code> has parameters.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
* @see #PARAMETERS_NAME
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return PARAMETERS_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoExecuteTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoExecuteTypeTaglet tag = new MojoExecuteTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@executionStrategy</tt> tag is used to specify the instantiation strategy and has has parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @executionStrategy <always>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'executionStrategy:t:Is executed with the strategy:'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoExecutionStrategyTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.EXECUTION_STATEGY;
|
||||
|
||||
protected static final String HEADER = "Is executed with the strategy";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>"*"</code> since <code>@executionStrategy</code> has a value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "*";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@executionStrategy</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoExecutionStrategyTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoExecutionStrategyTypeTaglet tag = new MojoExecutionStrategyTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@goal</tt> tag is used to reference the goal name of the Mojo and has annotation parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @goal <goalName>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'goal:t:Is defined by the goal name:'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoGoalTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.GOAL;
|
||||
|
||||
protected static final String HEADER = "Is defined by the goal name";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>"*"</code> since <code>@goal</code> has a value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "*";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@goal</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoGoalTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoGoalTypeTaglet tag = new MojoGoalTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@inheritByDefault</tt> tag is used to run this Mojo inside of a project
|
||||
* and has annotation parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @inheritByDefault <true|false>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'inheritByDefault:t:Is this Mojo inherited'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoInheritByDefaultTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.INHERIT_BY_DEFAULT;
|
||||
|
||||
protected static final String HEADER = "Is this Mojo inherited";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>"true|false"</code> since <code>@inheritByDefault</code> has specified values.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "true|false";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@inheritByDefault</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoInheritByDefaultTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoInheritByDefaultTypeTaglet tag = new MojoInheritByDefaultTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@instantiationStrategy</tt> tag is used to specify the instantiation strategy and has has parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @instantiationStrategy <per-lookup>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'instantiationStrategy:t:Is instantiated with the strategy:'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoInstantiationStrategyTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.INSTANTIATION_STRATEGY;
|
||||
|
||||
protected static final String HEADER = "Is instantiated with the strategy";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>"*"</code> since <code>@instantiationStrategy</code> has value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "*";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@instantiationStrategy</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoInstantiationStrategyTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoInstantiationStrategyTypeTaglet tag = new MojoInstantiationStrategyTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@parameter</tt> tag is used to define a Mojo parameter and has annotation parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* public class MyMojo extends AbstractMojo
|
||||
* {
|
||||
* /**
|
||||
*  * Dummy parameter.
|
||||
*  *
|
||||
*  * @parameter <alias="..."> <default-value="..."> <expression="...">
|
||||
*  * <implementation="..."> <property="...">
|
||||
*  * ...
|
||||
*  */
|
||||
* private Object parameterName;
|
||||
* }
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoParameterFieldTaglet
|
||||
extends AbstractMojoFieldTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.PARAMETER;
|
||||
|
||||
private static final String[] PARAMETERS_NAME = {
|
||||
JavaMojoAnnotation.PARAMETER_ALIAS,
|
||||
JavaMojoAnnotation.PARAMETER_DEFAULT_VALUE,
|
||||
JavaMojoAnnotation.PARAMETER_EXPRESSION,
|
||||
JavaMojoAnnotation.PARAMETER_IMPLEMENTATION,
|
||||
JavaMojoAnnotation.PARAMETER_PROPERTY };
|
||||
|
||||
protected static final String HEADER = "Is defined by";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@parameter</code> has no value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>MojoParameterFieldTaglet#PARAMETERS_NAME</code> since <code>@parameter</code> has parameters.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return PARAMETERS_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoParameterFieldTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoParameterFieldTaglet tag = new MojoParameterFieldTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@phase</tt> tag is used to reference the binded phase name of the Mojo and has has parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @phase <phaseName>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'phase:t:Is binded to the specified phase of the standard build lifecycle:'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoPhaseTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.PHASE;
|
||||
|
||||
protected static final String HEADER = "Is binded to the specified phase of the standard build lifecycle";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>"*"</code> since <code>@phase</code> has value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "*";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@phase</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoPhaseTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoPhaseTypeTaglet tag = new MojoPhaseTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@readonly</tt> tag is used to specify that this parameter cannot be configured directly by the
|
||||
* user and has no parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* public class MyMojo extends AbstractMojo
|
||||
* {
|
||||
* /**
|
||||
*  * Dummy parameter.
|
||||
*  *
|
||||
*  * @readonly
|
||||
*  * ...
|
||||
*  */
|
||||
* private Object parameterName;
|
||||
* }
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'readonly:f:Is readonly.'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoReadOnlyFieldTaglet
|
||||
extends AbstractMojoFieldTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.READONLY;
|
||||
|
||||
protected static final String HEADER = "Is readonly.";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@readonly</code> has no value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@readonly</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoReadOnlyFieldTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoReadOnlyFieldTaglet tag = new MojoReadOnlyFieldTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@required</tt> tag is used to specify that this parameter is required for the Mojo
|
||||
* and has no parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* public class MyMojo extends AbstractMojo
|
||||
* {
|
||||
* /**
|
||||
*  * Dummy parameter.
|
||||
*  *
|
||||
*  * @required
|
||||
*  * ...
|
||||
*  */
|
||||
* private Object parameterName;
|
||||
* }
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'required:f:Is required.'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoRequiredFieldTaglet
|
||||
extends AbstractMojoFieldTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.REQUIRED;
|
||||
|
||||
protected static final String HEADER = "Is required.";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@required</code> has no value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@required</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoRequiredFieldTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoRequiredFieldTaglet tag = new MojoRequiredFieldTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@requiresDependencyResolution</tt> tag is used to specify the required dependencies in the specified scope
|
||||
* and has parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @requiresDependencyResolution <requiredScope>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'requiresDependencyResolution:t:Requires the dependencies in this specified scope:'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoRequiresDependencyResolutionTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.REQUIRES_DEPENDENCY_RESOLUTION;
|
||||
|
||||
protected static final String HEADER = "Requires the dependencies in this specified scope";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>"*"</code> since <code>@requiresDependencyResolution</code> has value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "*";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@requiresDependencyResolution</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoRequiresDependencyResolutionTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoRequiresDependencyResolutionTypeTaglet tag = new MojoRequiresDependencyResolutionTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@requiresDirectInvocation</tt> tag is used to allow this Mojo to be direct invoked by the user.
|
||||
* and has parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @requiresDirectInvocation <true|false>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'requiresDirectInvocation:t:Requires a direct invocation by the user'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoRequiresDirectInvocationTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.REQUIRES_DIRECT_INVOCATION;
|
||||
|
||||
protected static final String HEADER = "Requires a direct invocation by the user";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>"false|true"</code> since <code>@requiresDirectInvocation</code> has value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "false|true";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@requiresDirectInvocation</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoRequiresDirectInvocationTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoRequiresDirectInvocationTypeTaglet tag = new MojoRequiresDirectInvocationTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@requiresOnline</tt> tag is used to specify that this Mojo should be online
|
||||
* and has parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @requiresOnline <true|false>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'requiresOnline:t:Requires to be online to run'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoRequiresOnLineTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.REQUIRES_ONLINE;
|
||||
|
||||
protected static final String HEADER = "Requires to be online to run";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true|false</code> since <code>@requiresOnline</code> has value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "true|false";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@requiresOnline</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoRequiresOnLineTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoRequiresOnLineTypeTaglet tag = new MojoRequiresOnLineTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@requiresProject</tt> tag is used to run this Mojo inside of a project
|
||||
* and has parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @requiresProject <true|false>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'requiresProject:t:Requires a Maven project to run'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoRequiresProjectTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.REQUIRES_PROJECT;
|
||||
|
||||
protected static final String HEADER = "Requires a Maven project to run";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>true|false</code> since <code>@requiresProject</code> has value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "true|false";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@requiresProject</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoRequiresProjectTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoRequiresProjectTypeTaglet tag = new MojoRequiresProjectTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.maven.tools.plugin.extractor.java.JavaMojoAnnotation;
|
||||
|
||||
import com.sun.tools.doclets.Taglet;
|
||||
|
||||
/**
|
||||
* The <tt>@requiresReports</tt> tag is used to run this Mojo inside reports
|
||||
* and has parameter.
|
||||
* <br/>
|
||||
* The following is a sample declaration:
|
||||
* <pre>
|
||||
* /**
|
||||
*  * Dummy Mojo.
|
||||
*  *
|
||||
*  * @requiresReports <true|false>
|
||||
*  * ...
|
||||
*  */
|
||||
* public class MyMojo extends AbstractMojo{}
|
||||
* </pre>
|
||||
* To use it, calling the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -taglet 'org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet'
|
||||
* </pre>
|
||||
* <b>Note</b>: This taglet is similar to call the <code>Javadoc</code> tool with the following:
|
||||
* <pre>
|
||||
* javadoc ... -tag 'requiresReports:t:Requires Maven reports to run'
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="package-summary.html#package_description">package-summary.html</a>
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class MojoRequiresReportsTypeTaglet
|
||||
extends AbstractMojoTypeTaglet
|
||||
{
|
||||
private static final String NAME = JavaMojoAnnotation.REQUIRES_REPORTS;
|
||||
|
||||
protected static final String HEADER = "Requires Maven reports to run";
|
||||
|
||||
/**
|
||||
* @return By default, return the string defined in {@linkplain #HEADER}.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getHeader()
|
||||
* @see #HEADER
|
||||
*/
|
||||
public String getHeader()
|
||||
{
|
||||
return HEADER;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>false|true</code> since <code>@requiresReports</code> has value.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedValue()
|
||||
*/
|
||||
public String getAllowedValue()
|
||||
{
|
||||
return "false|true";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <code>null</code> since <code>@requiresReports</code> has no parameter.
|
||||
* @see org.apache.maven.tools.plugin.javadoc.AbstractMojoTaglet#getAllowedParameterNames()
|
||||
*/
|
||||
public String[] getAllowedParameterNames()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return By default, return the name of this taglet.
|
||||
* @see com.sun.tools.doclets.Taglet#getName()
|
||||
* @see MojoRequiresReportsTypeTaglet#NAME
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this Taglet.
|
||||
*
|
||||
* @param tagletMap the map to register this tag to.
|
||||
*/
|
||||
public static void register( Map tagletMap )
|
||||
{
|
||||
MojoRequiresReportsTypeTaglet tag = new MojoRequiresReportsTypeTaglet();
|
||||
Taglet t = (Taglet) tagletMap.get( tag.getName() );
|
||||
if ( t != null )
|
||||
{
|
||||
tagletMap.remove( tag.getName() );
|
||||
}
|
||||
tagletMap.put( tag.getName(), tag );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,328 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<body>
|
||||
<style type="text/css">
|
||||
table.bodyTable th {
|
||||
color: white;
|
||||
background-color: #bbb;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.bodyTable th, table.bodyTable td {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
table.bodyTable tr.a {
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
table.bodyTable tr.b {
|
||||
background-color: #eee;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>Mojo Javadoc Tags used by Maven Plugins</h1>
|
||||
<p>Here is a reference of the Javadoc annotations that can be used to 'decorate' the Java sources
|
||||
to allow Mojo to generate descriptors.</p>
|
||||
|
||||
<h2>Annotations specified at the class level</h2>
|
||||
<table class="bodyTable">
|
||||
<!-- Annotations listed by specific, autodetect and Javadoc, all alphabetical -->
|
||||
<tr class="b">
|
||||
<th>Descriptor Element</th>
|
||||
<th>Annotation</th>
|
||||
<th>Required?</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>aggregator</td>
|
||||
<td>@aggregator</td>
|
||||
<td>No</td>
|
||||
<td>Flags this Mojo to run it in a multi module way, i.e. aggregate the build with the set of
|
||||
projects listed as modules.</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>configurator</td>
|
||||
<td>@configurator <roleHint></td>
|
||||
<td>No</td>
|
||||
<td>The configurator type to use when injecting parameter values into this Mojo. The value is
|
||||
normally deduced from the Mojo's implementation language, but can be specified to allow a
|
||||
custom ComponentConfigurator implementation to be used. <i>NOTE: This will only be used in
|
||||
very special cases, using a highly controlled vocabulary of possible values. (Elements
|
||||
like this are why it's a good idea to use the descriptor tools.)</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>execute</td>
|
||||
<td>
|
||||
<ul>
|
||||
<li>@execute phase="<phaseName>"
|
||||
lifecycle="<lifecycleId>"</li>
|
||||
<li>@execute phase="<phaseName>"</li>
|
||||
|
||||
<li>@execute goal="<goalName>"</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>No</td>
|
||||
<td>When this goal is invoked, it will first invoke a parallel lifecycle, ending at the given
|
||||
phase. If a goal is provided instead of a phase, that goal will be executed in isolation.
|
||||
The execution of either will not affect the current project, but instead make available the
|
||||
<code>${executedProject}</code> expression if required. An alternate lifecycle can also be
|
||||
provided: for more information see the documentation on the
|
||||
<a href="../guides/introduction/introduction-to-the-lifecycle.html">build lifecycle</a>.</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>executionStrategy</td>
|
||||
<td>@executionStrategy <strategy></td>
|
||||
<td>No</td>
|
||||
<td>Specify the execution strategy. <i>NOTE: Currently supports <b>once-per-session</b>,
|
||||
<b>always</b>.</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>goal</td>
|
||||
<td>@goal <goalName></td>
|
||||
<td>Yes</td>
|
||||
<td>The name for the Mojo that users will reference from the command line to execute the Mojo
|
||||
directly, or inside a POM in order to provide Mojo-specific configuration.</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>inheritByDefault</td>
|
||||
<td>@inheritByDefault <true|false></td>
|
||||
<td>No. Default: <code>true</code></td>
|
||||
<td>Specify that the Mojo is inherited.</td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>instantiationStrategy </td>
|
||||
<td>@instantiationStrategy <per-lookup></td>
|
||||
<td>No. Default: <code>per-lookup</code></td>
|
||||
<td>Specify the instantiation strategy.</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>phase</td>
|
||||
<td>@phase <phaseName></td>
|
||||
<td>No</td>
|
||||
<td>Binds this Mojo to a particular phase of the standard build lifecycle, if specified.
|
||||
<i>NOTE: This is only required if this Mojo is to participate in the standard build
|
||||
process.</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>requiresDependencyResolution</td>
|
||||
<td>@requiresDependencyResolution <requiredScope></td>
|
||||
<td>No</td>
|
||||
<td>Flags this Mojo as requiring the dependencies in the specified scope (or an implied scope)
|
||||
to be resolved before it can execute. <i>NOTE: Currently supports <b>compile</b> ,
|
||||
<b>runtime</b> , and <b>test</b> scopes. </i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>requiresDirectInvocation</td>
|
||||
<td>@requiresDirectInvocation <true|false></td>
|
||||
<td>No. Default: <code>false</code></td>
|
||||
<td>Flags this Mojo to be invoke directly.</td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>requiresOnline</td>
|
||||
<td>@requiresOnline <true|false></td>
|
||||
<td>No. Default: <code>true</code></td>
|
||||
<td>Flags this Mojo to be run in online mode.</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>requiresProject</td>
|
||||
<td>@requiresProject <true|false></td>
|
||||
<td>No. Default: <code>true</code></td>
|
||||
<td>Flags this Mojo to run inside of a project.</td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>requiresReports</td>
|
||||
<td>@requiresReports <true|false></td>
|
||||
<td>No. Default: <code>false</code></td>
|
||||
<td>Flags this Mojo to require reports.</td>
|
||||
</tr>
|
||||
|
||||
<!-- Autodetect -->
|
||||
<tr class="b">
|
||||
<td>description</td>
|
||||
<td>none (detected)</td>
|
||||
<td>No</td>
|
||||
<td>The description of this Mojo's functionality. <i>Using the toolset, this will be the
|
||||
class-level Javadoc description provided. NOTE: While this is not a required part of the
|
||||
Mojo specification, it SHOULD be provided to enable future tool support for browsing, etc.
|
||||
and for clarity.</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>implementation</td>
|
||||
<td>none (detected)</td>
|
||||
<td>Yes</td>
|
||||
<td>The Mojo's fully-qualified class name (or script path in the case of non-Java Mojos).</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>language</td>
|
||||
<td>none (detected)</td>
|
||||
<td>No. Default: <code>java</code></td>
|
||||
<td>The implementation language for this Mojo (Java, beanshell, etc.).</td>
|
||||
</tr>
|
||||
|
||||
<!-- Javadoc -->
|
||||
<tr class="a">
|
||||
<td>deprecated</td>
|
||||
<td>@deprecated <deprecated-text></td>
|
||||
<td>No</td>
|
||||
<td>Specify the version when the Mojo was deprecated to the API. Similar to Javadoc deprecated.
|
||||
This will trigger a warning when a user tries to configure a parameter
|
||||
marked as deprecated.</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>since</td>
|
||||
<td>@since <since-text></td>
|
||||
<td>No</td>
|
||||
<td>Specify the version when the Mojo was added to the API. Similar to Javadoc since.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>Annotations specified at the field level</h2>
|
||||
<table class="bodyTable">
|
||||
<!-- Annotations listed by specific, autodetect and Javadoc, all alphabetical -->
|
||||
<tr class="b">
|
||||
<th>Descriptor Element</th>
|
||||
<th>Annotation</th>
|
||||
<th>Required?</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>alias</td>
|
||||
<td>@parameter alias="myAlias"</td>
|
||||
<td>No</td>
|
||||
<td>Specifies an alias which can be used to configure this parameter from the POM. This is
|
||||
primarily useful to improve user-friendliness, where Mojo field names are not intuitive to
|
||||
the user or are otherwise not conducive to configuration via the POM.</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>configuration</td>
|
||||
<td>@component role="..." roleHint="..."</td>
|
||||
<td>No</td>
|
||||
<td> Populates the field with an instance of a Plexus component. This is like declaring a
|
||||
<i>requirement</i> in a Plexus component. The default requirement will have a role equal
|
||||
to the declared type of the field, and will use the default role hint. You can customise
|
||||
either of these by providing a <code>role</code> and/or <code>roleHint</code> parameter.
|
||||
<i>e.g.</i>
|
||||
<code>@component role="org.apache.maven.artifact.ArtifactHandler"
|
||||
roleHint="ear"</code><b>Note:</b> This is identical to the deprecated
|
||||
form of parameter: <code>@parameter
|
||||
expression="${component.yourpackage.YourComponentClass}"</code>. </td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>configuration</td>
|
||||
<td>@parameter expression="${someExpression}"
|
||||
default-value="value"</td>
|
||||
<td>No</td>
|
||||
<td>Specifies the expression used to calculate the value to be injected into this parameter of
|
||||
the Mojo at buildtime. This is commonly used to refer to specific elements in the POM, such
|
||||
as ${project.build.resources}, which refers to the List of resources meant to accompany the
|
||||
classes in the resulting jar file. The default value is used when the expression evaluates
|
||||
to <code>null</code> . <i>NOTE: If not specified, an expression of ${<name>}
|
||||
is assumed, which can only be satisfied from POM configuration or System properties. The
|
||||
use of '${' and '}' is required to delimit actual expressions which may be evaluated.</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>editable</td>
|
||||
<td>@readonly</td>
|
||||
<td>No</td>
|
||||
<td>Specifies that this parameter cannot be configured directly by the user (as in the case of
|
||||
POM-specified configuration). This is useful when you want to force the user to use common
|
||||
POM elements rather than plugin configurations, as in the case where you want to use the
|
||||
artifact's final name as a parameter. In this case, you want the user to modify
|
||||
<build><finalName/></build> rather than specifying
|
||||
a value for finalName directly in the plugin configuration section. It is also useful to
|
||||
ensure that - for example - a List-typed parameter which expects items of type Artifact
|
||||
doesn't get a List full of Strings. <i>NOTE: Specification of this annotation flags the
|
||||
parameter as non-editable; there is no true/false value.</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>required</td>
|
||||
<td>@required</td>
|
||||
<td>No</td>
|
||||
<td>Whether this parameter is required for the Mojo to function. This is used to validate the
|
||||
configuration for a Mojo before it is injected, and before the Mojo is executed from some
|
||||
half-state. <i>NOTE: Specification of this annotation flags the parameter as required; there
|
||||
is no true/false value.</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Autodetect -->
|
||||
<tr class="b">
|
||||
<td>description</td>
|
||||
<td>none (detected)</td>
|
||||
<td>No</td>
|
||||
<td>The description of this parameter's use inside the Mojo. <i>Using the toolset, this is
|
||||
detected as the Javadoc description for the field. NOTE: While this is not a required part
|
||||
of the parameter specification, it SHOULD be provided to enable future tool support for
|
||||
browsing, etc. and for clarity.</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="a">
|
||||
<td>name</td>
|
||||
<td>none (detected)</td>
|
||||
<td>Yes</td>
|
||||
<td>The name of the parameter, to be used in configuring this parameter from the Mojo's
|
||||
declared defaults (discussed below) or from the POM. <i>Using the toolset, this is detected
|
||||
as the Java field name.</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>type</td>
|
||||
<td>none (detected)</td>
|
||||
<td>Yes</td>
|
||||
<td>The Java type for this parameter. This is used to validate the result of any expressions
|
||||
used to calculate the value which should be injected into the Mojo for this parameter.
|
||||
<i>Using the toolset, this is detected as the class of the Java field corresponding to
|
||||
this parameter.</i>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- Javadoc -->
|
||||
<tr class="a">
|
||||
<td>deprecated</td>
|
||||
<td>@deprecated <deprecated-text></td>
|
||||
<td>No</td>
|
||||
<td>Specify the version when the Mojo was deprecated to the API. Similar to Javadoc deprecated.
|
||||
This will trigger a warning when a user tries to configure a parameter
|
||||
marked as deprecated.</td>
|
||||
</tr>
|
||||
<tr class="b">
|
||||
<td>since</td>
|
||||
<td>@since <since-text></td>
|
||||
<td>No</td>
|
||||
<td>Specify the version when the Mojo was added to the API. Similar to Javadoc since.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>Resources</h2>
|
||||
<ul>
|
||||
<li><a href="http://maven.apache.org/developers/mojo-api-specification.html#The_Descriptor_and_Annotations">Mojo API Specification</a></li>
|
||||
</ul>
|
||||
</body>
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
------
|
||||
Introduction
|
||||
------
|
||||
Vincent Siveton
|
||||
------
|
||||
February 2008
|
||||
------
|
||||
|
||||
~~ 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.
|
||||
|
||||
~~ NOTE: For help with the syntax of this file, see:
|
||||
~~ http://maven.apache.org/guides/mini/guide-apt-format.html
|
||||
|
||||
Maven Plugin Tools Javadoc
|
||||
|
||||
The Maven Plugin Tools Javadoc project is a collection of several
|
||||
{{{http://java.sun.com/j2se/1.4.2/docs/tooldocs/javadoc/taglet/overview.html}taglets}} which are used by
|
||||
the Plugin tool.
|
||||
For more information about the standard Javadoc tool, please refer to
|
||||
{{{http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html}Reference Guide}}.
|
||||
|
||||
* Usage
|
||||
|
||||
Instructions on how to use this project can be found {{{usage.html}here}}.
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
------
|
||||
Screenshots From Javadoc
|
||||
------
|
||||
Vincent Siveton
|
||||
------
|
||||
February 2008
|
||||
------
|
||||
|
||||
~~ 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.
|
||||
|
||||
~~ NOTE: For help with the syntax of this file, see:
|
||||
~~ http://maven.apache.org/guides/mini/guide-apt-format.html
|
||||
|
||||
Screenshots From Javadoc
|
||||
|
||||
The following Screenshots have been taken from a JavaDoc displayed.
|
||||
|
||||
[images/javadoc.png] Examples
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
------
|
||||
Usage
|
||||
------
|
||||
Vincent Siveton
|
||||
------
|
||||
February 2008
|
||||
------
|
||||
|
||||
~~ 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.
|
||||
|
||||
~~ NOTE: For help with the syntax of this file, see:
|
||||
~~ http://maven.apache.org/guides/mini/guide-apt-format.html
|
||||
|
||||
|
||||
Usage
|
||||
|
||||
The taglets could be use directly in the {{{http://maven.apache.org/plugins/maven-javadoc-plugin/}maven-javadoc-plugin}}.
|
||||
|
||||
+-----+
|
||||
<project>
|
||||
...
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
|
||||
<!-- To allow Javadoc Tool to generate annotation for Mojo fields -->
|
||||
<show>private</show>
|
||||
|
||||
<taglets>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
...
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
</taglets>
|
||||
|
||||
<tagletArtifact>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-javadoc</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</tagletArtifact>
|
||||
...
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
...
|
||||
</reporting>
|
||||
...
|
||||
</project>
|
||||
+-----+
|
||||
|
||||
<<Note>>: Several taglets are similars to the Javadoc
|
||||
{{{http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javadoc.html#tag}-tag}} option, i.e.:
|
||||
|
||||
*--------------------------------------------+---------------------------------+
|
||||
|| Taglet Class || Javadoc -tag option
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoAggregatorTypeTaglet | -tag 'aggregator:t:Aggregates the Maven project and its child modules.'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoComponentFieldTaglet | none
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoConfiguratorTypeTaglet | -tag 'configurator:t:Is configured to the role hint:'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoExecuteTypeTaglet | none
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoExecutionStrategyTypeTaglet | -tag 'executionStrategy:t:Is executed with the strategy:'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoGoalTypeTaglet | -tag 'goal:t:This Mojo is defined by the goal name:'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoInheritedByDefaultTypeTaglet | -tag 'inheritedByDefault:t:Is this Mojo inherited'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoInstantiationStrategyTypeTaglet | -tag 'instantiationStrategy:t:Is instantiated with the strategy:'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoParameterFieldTaglet | none
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoPhaseTypeTaglet | -tag 'phase:t:Is binded to the specified phase of the standard build lifecycle:'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoReadOnlyFieldTaglet | -tag 'readonly:f:Is readonly.'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoRequiredFieldTaglet | -tag 'required:f:Is required.'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoRequiresDependencyResolutionTypeTaglet | -tag 'requiresDependencyResolution:t:Requires the dependencies in this specified scope:'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoRequiresDirectInvocationTypeTaglet | -tag 'requiresDirectInvocation:t:Requires a direct invocation by the user'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoRequiresOnLineTypeTaglet | -tag 'requiresProject:t:Requires to be online to run'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoRequiresProjectTypeTaglet | -tag 'requiresProject:t:Requires a Maven project to run'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
| MojoRequiresReportsTypeTaglet | -tag 'requiresReports:t:Requires Maven reports to run'
|
||||
*--------------------------------------------+---------------------------------+
|
||||
|
||||
* Resources
|
||||
|
||||
* {{{apidocs/index.html}API}}
|
||||
|
||||
* {{{http://maven.apache.org/developers/mojo-api-specification.html#The_Descriptor_and_Annotations}Mojo API Specification}}
|
||||
|
||||
[]
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
|
|
@ -0,0 +1,32 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<project name="Maven Plugin Tools Javadoc">
|
||||
<body>
|
||||
<menu name="Overview">
|
||||
<item name="Introduction" href="index.html"/>
|
||||
<item name="Usage" href="usage.html"/>
|
||||
<item name="Screenshots From Javadoc" href="screenshots.html"/>
|
||||
</menu>
|
||||
|
||||
<menu ref="reports" inherit="bottom" />
|
||||
</body>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,164 @@
|
|||
package org.apache.maven.tools.plugin.javadoc;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolver;
|
||||
import org.apache.maven.plugin.javadoc.JavadocReport;
|
||||
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
|
||||
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
|
||||
/**
|
||||
* Test the taglets by running Maven Javadoc Plugin.
|
||||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class JavadocReportTest
|
||||
extends AbstractMojoTestCase
|
||||
{
|
||||
private static final String LINE_SEPARATOR = "";
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected void setUp()
|
||||
throws Exception
|
||||
{
|
||||
// required for mojo lookups to work
|
||||
super.setUp();
|
||||
createTestRepo();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
protected void tearDown()
|
||||
throws Exception
|
||||
{
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create test repository in target directory.
|
||||
*/
|
||||
private void createTestRepo()
|
||||
{
|
||||
File f = new File( getBasedir(), "target/local-repo/" );
|
||||
f.mkdirs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method that reads the contents of the specified file object into a string with a
|
||||
* <code>""</code> as line separator.
|
||||
*
|
||||
* @see #LINE_SEPARATOR
|
||||
* @param file the file to be read
|
||||
* @return a String object that contains the contents of the file
|
||||
* @throws IOException if any
|
||||
*/
|
||||
private static String readFile( File file )
|
||||
throws IOException
|
||||
{
|
||||
String str = "", strTmp = "";
|
||||
BufferedReader in = new BufferedReader( new FileReader( file ) );
|
||||
|
||||
while ( ( strTmp = in.readLine() ) != null )
|
||||
{
|
||||
str = str + LINE_SEPARATOR + strTmp;
|
||||
}
|
||||
in.close();
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the default javadoc renderer using the Maven plugin
|
||||
* <code>org.apache.maven.plugins:maven-javadoc-plugin:2.3</code>
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testMojoTaglets()
|
||||
throws Exception
|
||||
{
|
||||
File testPom = new File( getBasedir(), "src/test/resources/unit/javadoc/javadoc-plugin-config.xml" );
|
||||
PlexusConfiguration pluginConfiguration = extractPluginConfiguration( "maven-javadoc-plugin", testPom );
|
||||
|
||||
JavadocReport mojo = (JavadocReport) lookupMojo( "org.apache.maven.plugins", "maven-javadoc-plugin", "2.3",
|
||||
"javadoc", pluginConfiguration );
|
||||
|
||||
// Don't know why we need to specify that
|
||||
ArtifactRepository remoteRepositories = new DefaultArtifactRepository( "central",
|
||||
"http://repo1.maven.org/maven2",
|
||||
new DefaultRepositoryLayout() );
|
||||
setVariableValueToObject( mojo, "remoteRepositories", Collections.singletonList( remoteRepositories ) );
|
||||
|
||||
ArtifactRepository localRepository = (ArtifactRepository) getVariableValueFromObject( mojo, "localRepository" );
|
||||
ArtifactResolver resolver = (ArtifactResolver) getVariableValueFromObject( mojo, "resolver" );
|
||||
ArtifactFactory factory = (ArtifactFactory) getVariableValueFromObject( mojo, "factory" );
|
||||
Artifact artifact = factory.createArtifact( "org.apache.maven", "maven-plugin-api", "2.0", "compile", "jar" );
|
||||
resolver.resolve( artifact, Collections.singletonList( remoteRepositories ), localRepository );
|
||||
|
||||
mojo.execute();
|
||||
|
||||
File generatedFile = new File( getBasedir(),
|
||||
"target/test/unit/javadoc/target/site/apidocs/org/apache/maven/plugin/my/MyMojo.html" );
|
||||
assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
|
||||
|
||||
String str = readFile( generatedFile );
|
||||
|
||||
// Verify mojo type
|
||||
String mojoType = "<dl><dt><b>" + MojoAggregatorTypeTaglet.HEADER + "</b></dt><dd></dd><dt><b>"
|
||||
+ MojoConfiguratorTypeTaglet.HEADER + ":</b></dt><dd>roleHint</dd><dt><b>" + MojoExecuteTypeTaglet.HEADER
|
||||
+ ":</b></dt><dd><dl><dt><b>phase:</b></dt><dd>validate</dd>"
|
||||
+ "<dt><b>lifecycle:</b></dt><dd>default</dd></dl></dd><dt><b>" + MojoExecutionStrategyTypeTaglet.HEADER
|
||||
+ ":</b></dt><dd>always</dd>" + "<dt><b>" + MojoGoalTypeTaglet.HEADER + ":</b></dt><dd>touch</dd>"
|
||||
+ "<dt><b>" + MojoInheritByDefaultTypeTaglet.HEADER + ":</b></dt><dd>true</dd><dt><b>"
|
||||
+ MojoInstantiationStrategyTypeTaglet.HEADER + ":</b></dt><dd>per-lookup</dd><dt><b>"
|
||||
+ MojoPhaseTypeTaglet.HEADER + ":</b></dt><dd>phaseName</dd><dt><b>"
|
||||
+ MojoRequiresDependencyResolutionTypeTaglet.HEADER + ":</b></dt><dd>compile</dd><dt><b>"
|
||||
+ MojoRequiresDirectInvocationTypeTaglet.HEADER + ":</b></dt><dd>false</dd><dt><b>"
|
||||
+ MojoRequiresOnLineTypeTaglet.HEADER + ":</b></dt><dd>true</dd><dt><b>"
|
||||
+ MojoRequiresProjectTypeTaglet.HEADER + ":</b></dt><dd>true</dd><dt><b>"
|
||||
+ MojoRequiresReportsTypeTaglet.HEADER + ":</b></dt><dd>false</dd></dl>";
|
||||
assertTrue( str.toLowerCase().indexOf( ( mojoType ).toLowerCase() ) != -1 );
|
||||
|
||||
// Verify mojo fields
|
||||
String mojoField = "<dl><dt><b>" + MojoParameterFieldTaglet.HEADER
|
||||
+ ":</b></dt><dd><dl><dt><b>default-value:</b></dt>"
|
||||
+ "<dd>value</dd><dt><b>expression:</b></dt><dd>${project.build.directory}</dd><dt><b>alias:</b>"
|
||||
+ "</dt><dd>myAlias</dd></dl></dd><dt><b>" + MojoReadOnlyFieldTaglet.HEADER + "</b></dt><dd></dd><dt><b>"
|
||||
+ MojoRequiredFieldTaglet.HEADER + "</b></dt><dd>" + "</dd></dl>";
|
||||
assertTrue( str.toLowerCase().indexOf( ( mojoField ).toLowerCase() ) != -1 );
|
||||
|
||||
mojoField = "<dl><dt><b>" + MojoComponentFieldTaglet.HEADER + ":</b></dt><dd><dl><dt><b>role:</b>"
|
||||
+ "</dt><dd>org.apacha.maven.MyComponent</dd><dt><b>roleHint:</b></dt><dd>default</dd></dl></dd>"
|
||||
+ "<dt><b>" + MojoReadOnlyFieldTaglet.HEADER + "</b></dt><dd></dd><dt><b>" + MojoRequiredFieldTaglet.HEADER
|
||||
+ "</b></dt><dd>" + "</dd></dl>";
|
||||
assertTrue( str.toLowerCase().indexOf( ( mojoField ).toLowerCase() ) != -1 );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
package org.apache.maven.tools.plugin.javadoc.stubs;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.DefaultArtifact;
|
||||
import org.apache.maven.artifact.handler.DefaultArtifactHandler;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
|
||||
import org.apache.maven.artifact.versioning.VersionRange;
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Resource;
|
||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class DefaultMavenProjectStub
|
||||
extends MavenProjectStub
|
||||
{
|
||||
private Build build;
|
||||
|
||||
public DefaultMavenProjectStub()
|
||||
{
|
||||
MavenXpp3Reader pomReader = new MavenXpp3Reader();
|
||||
Model model = null;
|
||||
|
||||
try
|
||||
{
|
||||
model = pomReader.read( new FileReader( new File( getBasedir(), "javadoc-plugin-config.xml" ) ) );
|
||||
setModel( model );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
|
||||
setGroupId( model.getGroupId() );
|
||||
setArtifactId( model.getArtifactId() );
|
||||
setVersion( model.getVersion() );
|
||||
setName( model.getName() );
|
||||
setUrl( model.getUrl() );
|
||||
setPackaging( model.getPackaging() );
|
||||
|
||||
Build build = new Build();
|
||||
|
||||
build.setFinalName( model.getArtifactId() );
|
||||
build.setSourceDirectory( getBasedir() + "/src/main/java" );
|
||||
|
||||
Resource resource = new Resource();
|
||||
resource.setDirectory( getBasedir() + "/src/main/resources" );
|
||||
build.setResources( Collections.singletonList( resource ) );
|
||||
build.setDirectory( super.getBasedir() + "/target/test/unit/javadoc/target" );
|
||||
build.setOutputDirectory( super.getBasedir() + "/target/test/unit/javadoc/target/classes" );
|
||||
|
||||
build.setTestSourceDirectory( getBasedir() + "/src/test/java" );
|
||||
resource = new Resource();
|
||||
resource.setDirectory( getBasedir() + "/src/test/resources" );
|
||||
build.setTestResources( Collections.singletonList( resource ) );
|
||||
build.setTestOutputDirectory( super.getBasedir() + "/target/test/unit/javadoc/target/test-classes" );
|
||||
|
||||
setBuild( build );
|
||||
|
||||
List compileSourceRoots = new ArrayList();
|
||||
compileSourceRoots.add( getBasedir() + "/src/main/java" );
|
||||
setCompileSourceRoots( compileSourceRoots );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public Build getBuild()
|
||||
{
|
||||
return build;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void setBuild( Build build )
|
||||
{
|
||||
this.build = build;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public File getBasedir()
|
||||
{
|
||||
return new File( super.getBasedir() + "/src/test/resources/unit/javadoc" );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public List getRemoteArtifactRepositories()
|
||||
{
|
||||
ArtifactRepository repository = new DefaultArtifactRepository( "central", "http://repo1.maven.org/maven2",
|
||||
new DefaultRepositoryLayout() );
|
||||
|
||||
return Collections.singletonList( repository );
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public List getCompileArtifacts()
|
||||
{
|
||||
Artifact art = new DefaultArtifact( "org.apache.maven", "maven-plugin-api", VersionRange.createFromVersion( "2.0" ),
|
||||
Artifact.SCOPE_COMPILE, "jar", null, new DefaultArtifactHandler( "jar" ), false );
|
||||
art.setFile( new File( super.getBasedir() + "/target/local-repo/org/apache/maven/maven-plugin-api/2.0/maven-plugin-api-2.0.jar" ) );
|
||||
return Collections.singletonList( art );
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.apache.maven.tools.plugin.javadoc</groupId>
|
||||
<artifactId>test</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<inceptionYear>2008</inceptionYear>
|
||||
<name>Test Mojo Tags</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<project implementation="org.apache.maven.tools.plugin.javadoc.stubs.DefaultMavenProjectStub"/>
|
||||
<localRepository>${localRepository}</localRepository>
|
||||
<outputDirectory>${basedir}/target/test/unit/javadoc/target/site/apidocs</outputDirectory>
|
||||
|
||||
<debug>true</debug>
|
||||
<show>private</show>
|
||||
|
||||
<taglets>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
<taglet>
|
||||
<tagletClass>org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet</tagletClass>
|
||||
</taglet>
|
||||
</taglets>
|
||||
|
||||
<tagletArtifact>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-javadoc</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</tagletArtifact>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,114 @@
|
|||
package org.apache.maven.plugin.my;
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Goal which touches a timestamp file.
|
||||
*
|
||||
* @aggregator
|
||||
* @configurator roleHint
|
||||
* @execute phase="validate" lifecycle="default"
|
||||
* @executionStrategy always
|
||||
* @goal touch
|
||||
* @inheritByDefault true
|
||||
* @instantiationStrategy per-lookup
|
||||
* @phase phaseName
|
||||
* @requiresDependencyResolution compile
|
||||
* @requiresDirectInvocation
|
||||
* @requiresOnline
|
||||
* @requiresProject
|
||||
* @requiresReports
|
||||
*/
|
||||
public class MyMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* Location of the file.
|
||||
*
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
*/
|
||||
private File outputDirectory;
|
||||
|
||||
/**
|
||||
* Dummy parameter.
|
||||
*
|
||||
* @parameter expression="${project.build.directory}" default-value="value" alias="myAlias"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String dummy;
|
||||
|
||||
/**
|
||||
* Dummy component.
|
||||
*
|
||||
* @component role="org.apacha.maven.MyComponent" roleHint="default"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String component;
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
File f = outputDirectory;
|
||||
|
||||
if ( !f.exists() )
|
||||
{
|
||||
f.mkdirs();
|
||||
}
|
||||
|
||||
File touch = new File( f, "touch.txt" );
|
||||
|
||||
FileWriter w = null;
|
||||
try
|
||||
{
|
||||
w = new FileWriter( touch );
|
||||
|
||||
w.write( "touch.txt" );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error creating file " + touch, e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
if ( w != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
w.close();
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue