added default artifact handlers reference documentation

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@1372514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Herve Boutemy 2012-08-13 17:06:44 +00:00
parent aa7d0a5985
commit 19924774d9
3 changed files with 114 additions and 1 deletions

View File

@ -0,0 +1,41 @@
---
Default Artifact Handlers Reference
---
Hervé Boutemy
---
2012-08-13
---
Default Artifact Handlers Reference
Some artifact handlers are defined by default:
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
|| type || extension || packaging || classifier || language || added to classpath || includesDependencies ||
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<pom>>> | <= type> | <= type> | | none | | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<jar>>> | <= type> | <= type> | | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ejb>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ejb-client>>> | <<<jar>>> | <<<ejb>>> | <<<client>>> | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ejb3>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<test-jar>>> | <<<jar>>> | <<<jar>>> | <<<tests>>> | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<maven-plugin>>> | <<<jar>>> | <= type> | | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<java-source>>> | <<<jar>>> | <= type> | <<<sources>>> | java | | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<javadoc>>> | <<<jar>>> | <= type> | <<<javadoc>>> | java | <<<true>>> | |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<war>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<ear>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<rar>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+
| <<<par>>> | <= type> | <= type> | | java | | <<<true>>> |
*--------------------+------------+------------+---------------+-----------+---------------------+-----------------------+

View File

@ -3,7 +3,7 @@
-----
Hervé Boutemy
-----
2012-02-14
2012-08-13
-----
Maven Core
@ -14,6 +14,8 @@ Maven Core
* {{{./lifecycles.html}lifecycles}} and {{{./default-bindings.html}plugin bindings to <<<default>>> lifecycle}},
* {{{./artifact-handlers.html}default artifact handlers}},
* <<<ProjectBuilder>>> component ({{{./apidocs/org/apache/maven/project/ProjectBuilder.html}javadoc}}),
with its <<<DefaultProjectBuilder>>> implementation
({{{./xref/org/apache/maven/project/DefaultProjectBuilder.html}source}}),

View File

@ -0,0 +1,70 @@
package org.apache.maven.artifact.handler;
import java.io.File;
import java.util.List;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
public class ArtifactHandlerTest
extends PlexusTestCase
{
public void testAptConsistency()
throws Exception
{
File apt = getTestFile( "src/site/apt/artifact-handlers.apt" );
@SuppressWarnings( "unchecked" )
List<String> lines = FileUtils.loadFile( apt );
for ( String line : lines )
{
if ( line.startsWith( "||" ) )
{
String[] cols = line.split( "\\|\\|" );
String[] expected =
new String[] { "", "type", "extension", "packaging", "classifier", "language", "added to classpath",
"includesDependencies", "" };
int i = 0;
for ( String col : cols )
{
assertEquals( "Wrong column header", expected[i++], col.trim() );
}
}
else if ( line.startsWith( "|" ) )
{
String[] cols = line.split( "\\|" );
String type = trimApt( cols[1] );
String extension = trimApt( cols[2], type );
String packaging = trimApt( cols[3], type );
String classifier = trimApt( cols[4] );
String language = trimApt( cols[5] );
String addedToClasspath = trimApt( cols[6] );
String includesDependencies = trimApt( cols[7] );
ArtifactHandler handler = lookup( ArtifactHandler.class, type );
assertEquals( type + " extension", handler.getExtension(), extension );
assertEquals( type + " packaging", handler.getPackaging(), packaging );
assertEquals( type + " classifier", handler.getClassifier(), classifier );
assertEquals( type + " language", handler.getLanguage(), language );
assertEquals( type + " addedToClasspath", handler.isAddedToClasspath() ? "true" : null, addedToClasspath );
assertEquals( type + " includesDependencies", handler.isIncludesDependencies() ? "true" : null, includesDependencies );
}
}
}
private String trimApt( String content, String type )
{
String value = trimApt( content );
return "= type".equals( value ) ? type : value;
}
private String trimApt( String content )
{
content = content.replace( '<', ' ' ).replace( '>', ' ' ).trim();
return ( content.length() == 0 ) ? null : content;
}
}