Author: dennisl Date: Fri Aug 9 12:03:31 2013 New Revision: 1512271 URL: http://svn.apache.org/r1512271 Log: Add documentation.
Added: maven/shared/trunk/maven-mapping/src/site/ maven/shared/trunk/maven-mapping/src/site/apt/ maven/shared/trunk/maven-mapping/src/site/apt/index.apt.vm (with props) maven/shared/trunk/maven-mapping/src/site/site.xml (with props) Modified: maven/shared/trunk/maven-mapping/src/main/java/org/apache/maven/shared/mapping/MappingUtils.java Modified: maven/shared/trunk/maven-mapping/src/main/java/org/apache/maven/shared/mapping/MappingUtils.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-mapping/src/main/java/org/apache/maven/shared/mapping/MappingUtils.java?rev=1512271&r1=1512270&r2=1512271&view=diff ============================================================================== --- maven/shared/trunk/maven-mapping/src/main/java/org/apache/maven/shared/mapping/MappingUtils.java (original) +++ maven/shared/trunk/maven-mapping/src/main/java/org/apache/maven/shared/mapping/MappingUtils.java Fri Aug 9 12:03:31 2013 @@ -26,7 +26,7 @@ import org.codehaus.plexus.interpolation /** * <p> - * Utilities used to evaluate expression. + * Utilities used to evaluate an expression. * </p> * <p> * The expression might use any field of the {@link Artifact} interface. Some Added: maven/shared/trunk/maven-mapping/src/site/apt/index.apt.vm URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-mapping/src/site/apt/index.apt.vm?rev=1512271&view=auto ============================================================================== --- maven/shared/trunk/maven-mapping/src/site/apt/index.apt.vm (added) +++ maven/shared/trunk/maven-mapping/src/site/apt/index.apt.vm Fri Aug 9 12:03:31 2013 @@ -0,0 +1,85 @@ + ------ + Introduction + ------ + Dennis Lundberg + ------ + 2013-08-09 + ------ + + ~~ 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} + + These classes originates from the file name mapping code in Maven WAR Plugin. + + The goal is to provide a shared component for all plugins that need to do + mapping. + + +* MappingUtils + + This class ha a single method <<<evaluateFileNameMapping>>> that take an + expression and an <<<Artifact>>> as parameters. It returns a <<<String>>> + which is the result of interpolating the values from the <<<Artifact>>> + object into the expression. + + Here is a bit of code from the WAR Plugin showing how you can use it: + ++----- + protected String getFileName( Artifact artifact ) + { + if ( getOutputFileNameMapping() != null ) + { + // The user has specified a custom file name mapping expression + return MappingUtils.evaluateFileNameMapping( getOutputFileNameMapping(), artifact ); + } + + String classifier = artifact.getClassifier(); + if ( ( classifier != null ) && !( "".equals( classifier.trim() ) ) ) + { + // The artifact has a classifier - use the default expression for artifacts with classifier + return MappingUtils.evaluateFileNameMapping( MappingUtils.DEFAULT_FILE_NAME_MAPPING_CLASSIFIER, + artifact ); + } + else + { + // The artifact does not have a classifier - use the default expression for artifacts + return MappingUtils.evaluateFileNameMapping( MappingUtils.DEFAULT_FILE_NAME_MAPPING, artifact ); + } + } ++----- + + +* DashClassifierValueSource + + This is an implementation of the <<<ValueSource>>> interface, and can be used + for interpolation. <<<MappingUtils>>> uses it internally. It adds these two + tokens to an <<<Interpolator>>>: + + * <<<dashClassifier>>> + + * <<<dashClassifier?>>> + + [] + + You can invoke it like this: + ++----- + Interpolator interpolator = StringSearchInterpolator()); + interpolator.addValueSource( new DashClassifierValueSource( artifact.getClassifier() ) ); ++----- Propchange: maven/shared/trunk/maven-mapping/src/site/apt/index.apt.vm ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/shared/trunk/maven-mapping/src/site/apt/index.apt.vm ------------------------------------------------------------------------------ svn:keywords = Date Revision Author Id Added: maven/shared/trunk/maven-mapping/src/site/site.xml URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-mapping/src/site/site.xml?rev=1512271&view=auto ============================================================================== --- maven/shared/trunk/maven-mapping/src/site/site.xml (added) +++ maven/shared/trunk/maven-mapping/src/site/site.xml Fri Aug 9 12:03:31 2013 @@ -0,0 +1,32 @@ +<?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/DECORATION/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd"> + <body> + <menu name="Overview"> + <item name="Introduction" href="index.html"/> + <!--<item name="Usage" href="usage.html"/>--> + <item name="JavaDocs" href="apidocs/index.html"/> + <item name="Source Xref" href="xref/index.html"/> + <!--item name="FAQ" href="faq.html"/--> + </menu> + </body> +</project> Propchange: maven/shared/trunk/maven-mapping/src/site/site.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/shared/trunk/maven-mapping/src/site/site.xml ------------------------------------------------------------------------------ svn:keywords = Date Revision Author Id