Author: jdcasey
Date: Fri Aug 28 20:43:23 2009
New Revision: 809023
URL: http://svn.apache.org/viewvc?rev=809023&view=rev
Log:
[MRRESOURCES-11] Add filtering support for locally-overridden resource files.
Also adding the ability to supply a Velocity template file for the local
override. Finally, adding an integration-testing configuration to test all this
stuff.
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/pom.xml
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/plugin/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/plugin/rresource/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/plugin/rresource/it/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/plugin/rresource/it/App.java
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/pom.xml
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/plugin/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/plugin/rresource/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/plugin/rresource/it/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/resources/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/resources/DEPENDENCIES.vm
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/pom.xml
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/plugin/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/plugin/rresource/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/plugin/rresource/it/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/resources/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/resources/DEPENDENCIES
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/pom.xml
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/pom.xml
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/src/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/src/main/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/src/main/resources/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/src/main/resources/DEPENDENCIES.vm
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/AbstractIT.java
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT000_GenerateFromBundle.java
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT001_GenerateFromOverride.java
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT002_FilterLocalOverride.java
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/BootstrapInstaller.java
(with props)
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/TestUtils.java
(with props)
Modified:
maven/plugins/trunk/maven-remote-resources-plugin/pom.xml
maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
Modified: maven/plugins/trunk/maven-remote-resources-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/pom.xml?rev=809023&r1=809022&r2=809023&view=diff
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-remote-resources-plugin/pom.xml Fri Aug 28
20:43:23 2009
@@ -62,6 +62,11 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-filtering</artifactId>
+ <version>1.0-beta-3</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.0.5</version>
@@ -119,8 +124,13 @@
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-interpolation</artifactId>
+ <version>1.12</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>1.5.1</version>
+ <version>1.5.12</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
@@ -150,9 +160,38 @@
<version>1.0-beta-6</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-verifier</artifactId>
+ <version>1.2-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ </testResources>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+ <includes>
+ <include>**/*Test.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.modello</groupId>
@@ -218,4 +257,66 @@
</plugin>
</plugins>
</build>
+
+ <profiles>
+ <profile>
+ <id>run-its</id>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/it/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/IT*.java</include>
+ </includes>
+ <systemProperties>
+ <property>
+ <!-- Pass this through to the tests (if set!) to have
them pick the right repository -->
+ <name>maven.repo.local</name>
+ <value>${project.build.directory}/it-repo</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.3</version>
+ <executions>
+ <execution>
+ <id>install-descriptor</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ <configuration>
+
<localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/pom.xml?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/pom.xml
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/pom.xml
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,44 @@
+<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.plugin.rresource.it</groupId>
+ <artifactId>000-generateFromBundle</artifactId>
+ <version>${project.version}</version>
+
+ <repositories>
+ <repository>
+ <id>main-local</id>
+ <url>file:${localRepository}</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>remote-resources</id>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <resourceBundles>
+
<resourceBundle>org.apache.maven.plugin.rresource.it:resource-bundle-with-template:${project.version}</resourceBundle>
+ </resourceBundles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/plugin/rresource/it/App.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/plugin/rresource/it/App.java?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/plugin/rresource/it/App.java
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/plugin/rresource/it/App.java
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,13 @@
+package org.apache.maven.plugin.rresource.it;
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/000-generateFromBundle/src/main/java/org/apache/maven/plugin/rresource/it/App.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/pom.xml?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/pom.xml
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/pom.xml
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,44 @@
+<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.plugin.rresource.it</groupId>
+ <artifactId>001-generateFromOverride</artifactId>
+ <version>${project.version}</version>
+
+ <repositories>
+ <repository>
+ <id>main-local</id>
+ <url>file:${localRepository}</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>remote-resources</id>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <resourceBundles>
+
<resourceBundle>org.apache.maven.plugin.rresource.it:resource-bundle-with-template:${project.version}</resourceBundle>
+ </resourceBundles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,13 @@
+package org.apache.maven.plugin.rresource.it;
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/resources/DEPENDENCIES.vm
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/resources/DEPENDENCIES.vm?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/resources/DEPENDENCIES.vm
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/resources/DEPENDENCIES.vm
Fri Aug 28 20:43:23 2009
@@ -0,0 +1 @@
+Override: #if ($projectName)$projectName#else${project.name}#end
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/001-generateFromOverride/src/main/resources/DEPENDENCIES.vm
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/pom.xml?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/pom.xml
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/pom.xml
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,55 @@
+<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.plugin.rresource.it</groupId>
+ <artifactId>002-filterLocalOverride</artifactId>
+ <version>${project.version}</version>
+
+ <repositories>
+ <repository>
+ <id>main-local</id>
+ <url>file:${localRepository}</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
+ <plugins>
+ <plugin>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <version>${project.version}</version>
+ <executions>
+ <execution>
+ <id>remote-resources</id>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <resourceBundles>
+
<resourceBundle>org.apache.maven.plugin.rresource.it:resource-bundle-with-template:${project.version}</resourceBundle>
+ </resourceBundles>
+ <filterDelimiters>
+ <filterDelimiter>#{*}</filterDelimiter>
+ </filterDelimiters>
+ <filterUsesDefaultDelimiters>false</filterUsesDefaultDelimiters>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,13 @@
+package org.apache.maven.plugin.rresource.it;
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/java/org/apache/maven/plugin/rresource/it/App.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/resources/DEPENDENCIES
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/resources/DEPENDENCIES?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/resources/DEPENDENCIES
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/002-filterLocalOverride/src/main/resources/DEPENDENCIES
Fri Aug 28 20:43:23 2009
@@ -0,0 +1 @@
+Override: #{project.artifactId}
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/pom.xml?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/pom.xml
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/pom.xml
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,45 @@
+<?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.plugin.rresource.it</groupId>
+ <artifactId>bootstrap</artifactId>
+ <version>${project.version}</version>
+
+ <packaging>pom</packaging>
+
+ <name>IT Bootstrap</name>
+
+ <repositories>
+ <repository>
+ <id>main-local</id>
+ <url>file:${localRepository}</url>
+ </repository>
+ </repositories>
+
+ <modules>
+ <module>resource-bundle-with-template</module>
+ </modules>
+
+</project>
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/pom.xml?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/pom.xml
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/pom.xml
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,54 @@
+<?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>
+ <groupId>org.apache.maven.plugin.rresource.it</groupId>
+ <artifactId>bootstrap</artifactId>
+ <version>${project.version}</version>
+ </parent>
+
+ <artifactId>resource-bundle-with-template</artifactId>
+
+ <name>Resource Bundle with a Template</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+
+ <!-- Use an established version, not the one currently under test. -->
+ <version>1.0</version>
+
+ <executions>
+ <execution>
+ <goals>
+ <goal>bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/src/main/resources/DEPENDENCIES.vm
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/src/main/resources/DEPENDENCIES.vm?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/src/main/resources/DEPENDENCIES.vm
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/src/main/resources/DEPENDENCIES.vm
Fri Aug 28 20:43:23 2009
@@ -0,0 +1 @@
+Built-In: #if ($projectName)$projectName#else${project.name}#end
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-template/src/main/resources/DEPENDENCIES.vm
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java?rev=809023&r1=809022&r2=809023&view=diff
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
(original)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
Fri Aug 28 20:43:23 2009
@@ -53,13 +53,21 @@
import org.apache.maven.shared.downloader.DownloadException;
import org.apache.maven.shared.downloader.DownloadNotFoundException;
import org.apache.maven.shared.downloader.Downloader;
+import org.apache.maven.shared.filtering.MavenFileFilter;
+import org.apache.maven.shared.filtering.MavenFileFilterRequest;
+import org.apache.maven.shared.filtering.MavenFilteringException;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity;
+import org.apache.velocity.exception.MethodInvocationException;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
import org.codehaus.plexus.resource.ResourceManager;
import org.codehaus.plexus.resource.loader.FileResourceLoader;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.WriterFactory;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.codehaus.plexus.velocity.VelocityComponent;
@@ -75,7 +83,9 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import java.io.Reader;
import java.io.StringReader;
+import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
@@ -117,6 +127,38 @@
extends AbstractMojo
{
+ private static final String TEMPLATE_SUFFIX = ".vm";
+
+ /**
+ * <p>
+ * In cases where a local resource overrides one from a remote resource
bundle, that resource
+ * should be filtered if the resource set specifies it. In those cases,
this parameter defines
+ * the list of delimiters for filterable expressions. These delimiters are
specified in the
+ * form 'beginToken*endToken'. If no '*' is given, the delimiter is
assumed to be the same for start and end.
+ * </p>
+ * <p>
+ * So, the default filtering delimiters might be specified as:
+ * </p>
+ * <pre>
+ * <delimiters>
+ * <delimiter>${*}</delimiter>
+ * <delimiter>@</delimiter>
+ * </delimiters>
+ * </pre>
+ * <p>
+ * Since the '@' delimiter is the same on both ends, we don't need to
specify '@*@' (though we can).
+ * </p>
+ * @parameter
+ * @since 1.1
+ */
+ protected List filterDelimiters;
+
+ /**
+ * @parameter default-value="true"
+ * @since 1.1
+ */
+ protected boolean filterUsesDefaultDelimiters;
+
/**
* If true, only generate resources in the directory of the root project
in a multimodule build.
* Dependencies from all modules will be aggregated before
resource-generation takes place.
@@ -124,9 +166,16 @@
* @parameter default-value="false"
* @since 1.1
*/
- private boolean runOnlyAtExecutionRoot;
+ protected boolean runOnlyAtExecutionRoot;
/**
+ * The character encoding scheme to be applied when filtering resources.
+ *
+ * @parameter expression="${encoding}"
default-value="${project.build.sourceEncoding}"
+ */
+ protected String encoding;
+
+ /**
* The local repository taken from Maven's runtime. Typically
$HOME/.m2/repository.
*
* @parameter expression="${localRepository}"
@@ -269,6 +318,13 @@
* @required
*/
private VelocityComponent velocity;
+
+ /**
+ * Filtering support, for local resources that override those in the
remote bundle.
+ *
+ * @component
+ */
+ private MavenFileFilter fileFilter;
// These two things make this horrible. Maven artifact is way too
complicated and the relationship between
// the model usage and maven-artifact needs to be reworked as well as all
our tools that deal with it. The
@@ -571,8 +627,7 @@
}
catch ( ProjectBuildingException e )
{
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new MojoExecutionException( e.getMessage(), e );
}
catch ( InvalidRepositoryException e )
{
@@ -672,8 +727,8 @@
return organizations;
}
- protected boolean copyResourceIfExists( File file, String relFileName )
- throws IOException
+ protected boolean copyResourceIfExists( File file, String relFileName,
VelocityContext context )
+ throws IOException, MojoExecutionException
{
for ( Iterator i = resources.iterator(); i.hasNext(); )
{
@@ -684,13 +739,74 @@
{
continue;
}
+
//TODO - really should use the resource includes/excludes and name
mapping
File source = new File( resourceDirectory, relFileName );
+ File templateSource = new File( resourceDirectory, relFileName +
TEMPLATE_SUFFIX );
+
+ if ( !source.exists() && templateSource.exists() )
+ {
+ source = templateSource;
+ }
if ( source.exists() && !source.equals( file ) )
{
- //TODO - should use filters here
- FileUtils.copyFile( source, file );
+ if ( source == templateSource )
+ {
+ Reader reader = null;
+ Writer writer = null;
+ try
+ {
+ if ( encoding != null )
+ {
+ reader = new InputStreamReader( new
FileInputStream( source ), encoding );
+ writer = new OutputStreamWriter( new
FileOutputStream( file ), encoding );
+ }
+ else
+ {
+ reader = ReaderFactory.newPlatformReader( source );
+ writer = WriterFactory.newPlatformWriter( file );
+ }
+
+ velocity.getEngine().evaluate( context, writer, "",
reader );
+ velocity.getEngine().evaluate( context, writer, "",
reader );
+ }
+ catch ( ParseErrorException e )
+ {
+ throw new MojoExecutionException( "Error rendering
velocity resource.", e );
+ }
+ catch ( MethodInvocationException e )
+ {
+ throw new MojoExecutionException( "Error rendering
velocity resource.", e );
+ }
+ catch ( ResourceNotFoundException e )
+ {
+ throw new MojoExecutionException( "Error rendering
velocity resource.", e );
+ }
+ finally
+ {
+ IOUtil.close( writer );
+ IOUtil.close( reader );
+ }
+ }
+ else if ( resource.isFiltering() )
+ {
+
+ MavenFileFilterRequest req = setupRequest( resource,
source, file );
+
+ try
+ {
+ fileFilter.copyFile( req );
+ }
+ catch ( MavenFilteringException e )
+ {
+ throw new MojoExecutionException( "Error filtering
resource: " + source, e );
+ }
+ }
+ else
+ {
+ FileUtils.copyFile( source, file );
+ }
//exclude the original (so eclipse doesn't complain about
duplicate resources)
resource.addExclude( relFileName );
@@ -702,6 +818,37 @@
return false;
}
+ private MavenFileFilterRequest setupRequest( Resource resource, File
source, File file )
+ {
+ MavenFileFilterRequest req = new MavenFileFilterRequest();
+ req.setFrom( source );
+ req.setTo( file );
+ req.setFiltering( resource.isFiltering() );
+
+ req.setMavenProject( project );
+ req.setMavenSession( mavenSession );
+ req.setInjectProjectBuildFilters( true );
+
+ if ( encoding != null )
+ {
+ req.setEncoding( encoding );
+ }
+
+ if ( filterDelimiters != null && !filterDelimiters.isEmpty() )
+ {
+ LinkedHashSet delims = new LinkedHashSet();
+ if ( filterUsesDefaultDelimiters )
+ {
+ delims.addAll( req.getDelimiters() );
+ }
+ delims.addAll( filterDelimiters );
+
+ req.setDelimiters( delims );
+ }
+
+ return req;
+ }
+
protected void validate()
throws MojoExecutionException
{
@@ -860,7 +1007,7 @@
String projectResource = bundleResource;
boolean doVelocity = false;
- if ( projectResource.endsWith( ".vm" ) )
+ if ( projectResource.endsWith( TEMPLATE_SUFFIX ) )
{
projectResource = projectResource.substring( 0,
projectResource.length() - 3 );
doVelocity = true;
@@ -872,7 +1019,7 @@
FileUtils.mkdir( f.getParentFile().getAbsolutePath() );
- if ( !copyResourceIfExists( f, projectResource ) )
+ if ( !copyResourceIfExists( f, projectResource,
context ) )
{
if ( doVelocity )
{
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/AbstractIT.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/AbstractIT.java?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/AbstractIT.java
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/AbstractIT.java
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,17 @@
+package org.apache.maven.plugin.resources.remote.it;
+
+import org.apache.maven.plugin.resources.remote.it.support.BootstrapInstaller;
+
+import junit.framework.TestCase;
+
+public abstract class AbstractIT
+ extends TestCase
+{
+ public void setUp()
+ throws Exception
+ {
+ BootstrapInstaller.install();
+
+ super.setUp();
+ }
+}
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/AbstractIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT000_GenerateFromBundle.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT000_GenerateFromBundle.java?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT000_GenerateFromBundle.java
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT000_GenerateFromBundle.java
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,32 @@
+package org.apache.maven.plugin.resources.remote.it;
+
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.plugin.resources.remote.it.support.TestUtils;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+public class IT000_GenerateFromBundle
+ extends AbstractIT
+{
+
+ public void test()
+ throws IOException, URISyntaxException, VerificationException
+ {
+ File dir = TestUtils.getTestDir( "000-generateFromBundle" );
+ Verifier verifier = new Verifier( dir.getAbsolutePath() );
+
+ verifier.executeGoal( "generate-resources" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ File output = new File( dir,
"target/maven-shared-archive-resources/DEPENDENCIES" );
+ String content = FileUtils.fileRead( output );
+
+ assertTrue( content.indexOf( "Built-In:" ) > -1 );
+ }
+
+}
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT000_GenerateFromBundle.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT001_GenerateFromOverride.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT001_GenerateFromOverride.java?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT001_GenerateFromOverride.java
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT001_GenerateFromOverride.java
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,32 @@
+package org.apache.maven.plugin.resources.remote.it;
+
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.plugin.resources.remote.it.support.TestUtils;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+public class IT001_GenerateFromOverride
+ extends AbstractIT
+{
+
+ public void test()
+ throws IOException, URISyntaxException, VerificationException
+ {
+ File dir = TestUtils.getTestDir( "001-generateFromOverride" );
+ Verifier verifier = new Verifier( dir.getAbsolutePath() );
+
+ verifier.executeGoal( "generate-resources" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ File output = new File( dir,
"target/maven-shared-archive-resources/DEPENDENCIES" );
+ String content = FileUtils.fileRead( output );
+
+ assertTrue( content.indexOf( "Override:" ) > -1 );
+ }
+
+}
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT001_GenerateFromOverride.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT002_FilterLocalOverride.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT002_FilterLocalOverride.java?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT002_FilterLocalOverride.java
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT002_FilterLocalOverride.java
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,34 @@
+package org.apache.maven.plugin.resources.remote.it;
+
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+import org.apache.maven.plugin.resources.remote.it.support.TestUtils;
+import org.codehaus.plexus.util.FileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+public class IT002_FilterLocalOverride
+ extends AbstractIT
+{
+
+ public void test()
+ throws IOException, URISyntaxException, VerificationException
+ {
+ File dir = TestUtils.getTestDir( "002-filterLocalOverride" );
+ Verifier verifier = new Verifier( dir.getAbsolutePath() );
+
+ verifier.getCliOptions().add( "-X" );
+
+ verifier.executeGoal( "generate-resources" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ File output = new File( dir,
"target/maven-shared-archive-resources/DEPENDENCIES" );
+ String content = FileUtils.fileRead( output );
+
+ assertTrue( content.indexOf( "Override: 002-filterLocalOverride" ) >
-1 );
+ }
+
+}
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT002_FilterLocalOverride.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/BootstrapInstaller.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/BootstrapInstaller.java?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/BootstrapInstaller.java
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/BootstrapInstaller.java
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,33 @@
+package org.apache.maven.plugin.resources.remote.it.support;
+
+import org.apache.maven.it.VerificationException;
+import org.apache.maven.it.Verifier;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+public class BootstrapInstaller
+{
+
+ private static boolean installed = false;
+
+ public static void install()
+ throws IOException, URISyntaxException, VerificationException
+ {
+ if ( !installed )
+ {
+ File bootstrapDir = TestUtils.getTestDir( "bootstrap" );
+
+ Verifier verifier = new Verifier( bootstrapDir.getAbsolutePath() );
+
+ verifier.executeGoal( "install" );
+
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ installed = true;
+ }
+ }
+
+}
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/BootstrapInstaller.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/TestUtils.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/TestUtils.java?rev=809023&view=auto
==============================================================================
---
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/TestUtils.java
(added)
+++
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/TestUtils.java
Fri Aug 28 20:43:23 2009
@@ -0,0 +1,37 @@
+package org.apache.maven.plugin.resources.remote.it.support;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+public class TestUtils
+{
+ public static File getTestDir( final String name )
+ throws IOException, URISyntaxException
+ {
+ ClassLoader cloader = Thread.currentThread().getContextClassLoader();
+ URL resource = cloader.getResource( name );
+
+ if ( resource == null )
+ {
+ throw new IOException( "Cannot find test directory: " + name );
+ }
+
+ return new File( new URI( resource.toExternalForm()
).normalize().getPath() );
+ }
+
+ public static File getBaseDir()
+ {
+ File result = new File( System.getProperty( "basedir", "." ) );
+ try
+ {
+ return result.getCanonicalFile();
+ }
+ catch ( IOException e )
+ {
+ return result.getAbsoluteFile();
+ }
+ }
+}
Propchange:
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/support/TestUtils.java
------------------------------------------------------------------------------
svn:eol-style = native