You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sn...@apache.org on 2007/10/07 22:32:00 UTC
svn commit: r582675 - in /maven/plugins/trunk/maven-war-plugin: pom.xml
src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
src/main/java/org/apache/maven/plugin/war/util/MappingUtils.java
Author: snicoll
Date: Sun Oct 7 13:31:57 2007
New Revision: 582675
URL: http://svn.apache.org/viewvc?rev=582675&view=rev
Log:
MWAR-119: Update to latest plexus-utils
Modified:
maven/plugins/trunk/maven-war-plugin/pom.xml
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/MappingUtils.java
Modified: maven/plugins/trunk/maven-war-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/pom.xml?rev=582675&r1=582674&r2=582675&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-war-plugin/pom.xml Sun Oct 7 13:31:57 2007
@@ -31,7 +31,7 @@
<name>Maven War Plugin</name>
<version>2.1-alpha-1-SNAPSHOT</version>
<prerequisites>
- <maven>2.0.1</maven>
+ <maven>2.0.6</maven>
</prerequisites>
<issueManagement>
<system>JIRA</system>
@@ -41,7 +41,12 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
- <version>2.0.1</version>
+ <version>2.0.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -51,12 +56,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>2.0.1</version>
+ <version>1.4.6</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
@@ -72,7 +72,7 @@
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
- <version>1.0-beta-1</version>
+ <version>1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java?rev=582675&r1=582674&r2=582675&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/packaging/AbstractWarPackagingTask.java Sun Oct 7 13:31:57 2007
@@ -309,34 +309,6 @@
}
}
-
- /**
- * Copy file from source to destination only if source timestamp is later than the destination timestamp.
- * The directories up to <code>destination</code> will be created if they don't already exist.
- * <code>destination</code> will be overwritten if it already exists.
- *
- * @param source An existing non-directory <code>File</code> to copy bytes from.
- * @param destination A non-directory <code>File</code> to write bytes to (possibly
- * @throws IOException if <code>source</code> does not exist, <code>destination</code> cannot be
- * written to, or an IO error occurs during copying.
- * @throws java.io.FileNotFoundException if <code>destination</code> is a directory
- * <p/>
- * TO DO: Remove this method when Maven moves to plexus-util version 1.4
- * TODO: WARNING this needs to be refactored once the protected list system is up to date
- */
- protected void copyFileIfModified( File source, File destination )
- throws IOException
- {
- // TO DO: Remove this method and use the method in WarFileUtils when Maven 2 changes
- // to plexus-util 1.2.
- if ( destination.lastModified() < source.lastModified() )
- {
- FileUtils.copyFile( source.getCanonicalFile(), destination );
- // preserve timestamp
- destination.setLastModified( source.lastModified() );
- }
- }
-
/**
* Returns the file to copy. If the includes are <tt>null</tt> or empty, the
* default includes are used.
@@ -423,9 +395,6 @@
}};
}
- /**
- * TO DO: Remove this interface when Maven moves to plexus-util version 1.4
- */
private interface FilterWrapper
{
Reader getReader( Reader fileReader, Map filterProperties );
Modified: maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/MappingUtils.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/MappingUtils.java?rev=582675&r1=582674&r2=582675&view=diff
==============================================================================
--- maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/MappingUtils.java (original)
+++ maven/plugins/trunk/maven-war-plugin/src/main/java/org/apache/maven/plugin/war/util/MappingUtils.java Sun Oct 7 13:31:57 2007
@@ -20,16 +20,11 @@
*/
import org.apache.maven.artifact.Artifact;
-import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.interpolation.ObjectBasedValueSource;
+import org.codehaus.plexus.util.interpolation.RegexBasedInterpolator;
import org.codehaus.plexus.util.interpolation.ValueSource;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* Utilities used to evaluate expression.
@@ -93,83 +88,6 @@
public Object getValue( String key )
{
return properties.getProperty( key );
- }
-
- }
-
-
- /**
- * This a copy of the class in plexus-util 1.4
- * <p/>
- * TODO: remove this once the plugin can depend on plexus-util 1.4
- */
- static class RegexBasedInterpolator
- {
-
- private List valueSources;
-
- public RegexBasedInterpolator()
- {
- valueSources = new ArrayList();
- }
-
- public RegexBasedInterpolator( List valueSources )
- {
- this.valueSources = new ArrayList( valueSources );
- }
-
- public void addValueSource( ValueSource valueSource )
- {
- this.valueSources.add( valueSource );
- }
-
- public void removeValuesSource( ValueSource valueSource )
- {
- this.valueSources.remove( valueSource );
- }
-
- public String interpolate( String input, String thisPrefixPattern )
- {
- String result = input;
-
- Pattern expressionPattern = Pattern.compile( "\\$\\{(" + thisPrefixPattern + ")?([^}]+)\\}" );
- Matcher matcher = expressionPattern.matcher( result );
-
- while ( matcher.find() )
- {
- String wholeExpr = matcher.group( 0 );
- String realExpr = matcher.group( 2 );
-
- if ( realExpr.startsWith( "." ) )
- {
- realExpr = realExpr.substring( 1 );
- }
-
- Object value = null;
- for ( Iterator it = valueSources.iterator(); it.hasNext() && value == null; )
- {
- ValueSource vs = (ValueSource) it.next();
-
- value = vs.getValue( realExpr );
- }
-
- // if the expression refers to itself, die.
- if ( wholeExpr.equals( value ) )
- {
- throw new IllegalArgumentException( "Expression: \'" + wholeExpr + "\' references itself." );
- }
-
- if ( value != null )
- {
- result = StringUtils.replace( result, wholeExpr, String.valueOf( value ) );
- // could use:
- // result = matcher.replaceFirst( stringValue );
- // but this could result in multiple lookups of stringValue, and replaceAll is not correct behaviour
- matcher.reset( result );
- }
- }
-
- return result;
}
}