You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2012/01/09 23:10:41 UTC
svn commit: r1229389 - in
/maven/plugins/trunk/maven-remote-resources-plugin: ./ src/it/
src/it/resources/bootstrap/
src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/
src/it/resources/bootstrap/resource-bundle-with-type-and-classifie...
Author: rfscholte
Date: Mon Jan 9 22:10:40 2012
New Revision: 1229389
URL: http://svn.apache.org/viewvc?rev=1229389&view=rev
Log:
Fix MRRESOURCES-55: Support groupId:artifactId:version:type and groupId:artifactId:version:type:classifier as resource bundle references
Added:
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/pom.xml
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/src/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/src/main/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/src/main/resources/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/src/main/resources/DEPENDENCIES.vm
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/pom.xml
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/org/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/org/apache/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/org/apache/maven/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/org/apache/maven/plugin/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/org/apache/maven/plugin/rresource/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/org/apache/maven/plugin/rresource/it/
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/org/apache/maven/plugin/rresource/it/App.java
maven/plugins/trunk/maven-remote-resources-plugin/src/it/settings.xml
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT_GenerateFromBundleWithTypeAndClassifier.java
Modified:
maven/plugins/trunk/maven-remote-resources-plugin/pom.xml
maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/pom.xml
maven/plugins/trunk/maven-remote-resources-plugin/src/main/java/org/apache/maven/plugin/resources/remote/ProcessRemoteResourcesMojo.java
maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.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=1229389&r1=1229388&r2=1229389&view=diff
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-remote-resources-plugin/pom.xml Mon Jan 9 22:10:40 2012
@@ -112,11 +112,6 @@ under the License.
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-downloader</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
<artifactId>maven-filtering</artifactId>
<version>${mavenFilteringVersion}</version>
</dependency>
Modified: 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=1229389&r1=1229388&r2=1229389&view=diff
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/pom.xml (original)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/pom.xml Mon Jan 9 22:10:40 2012
@@ -48,6 +48,7 @@
<modules>
<module>resource-bundle-with-template</module>
<module>resource-bundle-with-org-processing</module>
+ <module>resource-bundle-with-type-and-classifier</module>
</modules>
</project>
Added: maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/pom.xml?rev=1229389&view=auto
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/pom.xml (added)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/pom.xml Mon Jan 9 22:10:40 2012
@@ -0,0 +1,61 @@
+<?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-type-and-classifier</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Resource Bundle with a Type and Classifier</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>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <classifier>test</classifier>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/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-type-and-classifier/src/main/resources/DEPENDENCIES.vm?rev=1229389&view=auto
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/src/main/resources/DEPENDENCIES.vm (added)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/bootstrap/resource-bundle-with-type-and-classifier/src/main/resources/DEPENDENCIES.vm Mon Jan 9 22:10:40 2012
@@ -0,0 +1,5 @@
+Built-In: #if ($projectName)$projectName#else${project.name}#end
+
+#foreach( $p in $projects )
+Dependency Id: $p.groupId:$p.artifactId:$p.version
+#end
Added: maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/pom.xml?rev=1229389&view=auto
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/pom.xml (added)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/pom.xml Mon Jan 9 22:10:40 2012
@@ -0,0 +1,35 @@
+<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>it-parent</artifactId>
+ <version>${project.version}</version>
+ <relativePath>../it-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>generate-from-bundle-with-type-and-classifier</artifactId>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>remote-resources</id>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ <configuration>
+ <resourceBundles>
+ <resourceBundle>org.apache.maven.plugin.rresource.it:resource-bundle-with-type-and-classifier:${project.version}:jar:test</resourceBundle>
+ </resourceBundles>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/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/generate-from-bundle-with-type-and-classifier/src/main/java/org/apache/maven/plugin/rresource/it/App.java?rev=1229389&view=auto
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/org/apache/maven/plugin/rresource/it/App.java (added)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/it/resources/generate-from-bundle-with-type-and-classifier/src/main/java/org/apache/maven/plugin/rresource/it/App.java Mon Jan 9 22:10:40 2012
@@ -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!" );
+ }
+}
Added: maven/plugins/trunk/maven-remote-resources-plugin/src/it/settings.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/it/settings.xml?rev=1229389&view=auto
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/it/settings.xml (added)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/it/settings.xml Mon Jan 9 22:10:40 2012
@@ -0,0 +1,55 @@
+<?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.
+-->
+
+<settings>
+ <profiles>
+ <profile>
+ <id>it-repo</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>local.central</id>
+ <url>@localRepositoryUrl@</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+</settings>
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=1229389&r1=1229388&r2=1229389&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 Mon Jan 9 22:10:40 2012
@@ -19,12 +19,43 @@ package org.apache.maven.plugin.resource
* under the License.
*/
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+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.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeMap;
+
import org.apache.maven.ProjectDependenciesResolver;
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.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Model;
@@ -48,9 +79,6 @@ import org.apache.maven.shared.artifact.
import org.apache.maven.shared.artifact.filter.collection.GroupIdFilter;
import org.apache.maven.shared.artifact.filter.collection.ScopeFilter;
import org.apache.maven.shared.artifact.filter.collection.TransitivityFilter;
-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;
@@ -70,36 +98,6 @@ import org.codehaus.plexus.util.xml.Xpp3
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.codehaus.plexus.velocity.VelocityComponent;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-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.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeMap;
-
/**
* <p>
* Pull down resourceBundles containing remote resources and process the
@@ -320,13 +318,13 @@ public class ProcessRemoteResourcesMojo
private List<Resource> resources;
/**
- * Artifact downloader.
- *
+ * Artifact Resolver, needed to resolve and download the {@code resourceBundles}.
+ *
* @component
* @readonly
* @required
*/
- private Downloader downloader;
+ private ArtifactResolver artifactResolver;
/**
* Velocity component.
@@ -932,12 +930,13 @@ public class ProcessRemoteResourcesMojo
{
int bundleCount = 1;
- for ( String artifactDescriptor : resourceBundles )
+ for ( String artifactDescriptor : resourceBundles )
{
- // groupId:artifactId:version
+ // groupId:artifactId:version, groupId:artifactId:version:type
+ // or groupId:artifactId:version:type:classifier
String[] s = StringUtils.split( artifactDescriptor, ":" );
- if ( s.length != 3 )
+ if ( s.length < 3 || s.length > 5 )
{
String position;
@@ -959,9 +958,11 @@ public class ProcessRemoteResourcesMojo
}
throw new MojoExecutionException( "The " + position +
- " resource bundle configured must specify a groupId, artifactId, and" +
- " version for a remote resource bundle. " +
- "Must be of the form <resourceBundle>groupId:artifactId:version</resourceBundle>" );
+ " resource bundle configured must specify a groupId, artifactId, " +
+ " version and, optionally, type and classifier for a remote resource bundle. " +
+ "Must be of the form <resourceBundle>groupId:artifactId:version</resourceBundle>, " +
+ "<resourceBundle>groupId:artifactId:version:type</resourceBundle> or " +
+ "<resourceBundle>groupId:artifactId:version:type:classifier</resourceBundle>" );
}
bundleCount++;
@@ -1011,9 +1012,10 @@ public class ProcessRemoteResourcesMojo
{
for ( String artifactDescriptor : bundles )
{
- // groupId:artifactId:version
+ // groupId:artifactId:version[:type[:classifier]]
String[] s = artifactDescriptor.split( ":" );
- File artifact = null;
+
+ File artifactFile = null;
//check if the artifact is part of the reactor
if ( mavenSession != null )
{
@@ -1024,25 +1026,32 @@ public class ProcessRemoteResourcesMojo
&& s[1].equals( p.getArtifactId() )
&& s[2].equals( p.getVersion() ) )
{
- artifact = new File( p.getBuild().getOutputDirectory() );
+ artifactFile = new File( p.getBuild().getOutputDirectory() );
}
}
}
- if ( artifact == null || !artifact.exists() )
+ if ( artifactFile == null || !artifactFile.exists() )
{
- artifact = downloader.download( s[0], s[1], s[2], localRepository, remoteArtifactRepositories );
- }
+ String type = ( s.length >= 4 ? s[3] : "jar" );
+ String classifier = ( s.length == 5 ? s[4] : null );
+ Artifact artifact =
+ artifactFactory.createDependencyArtifact( s[0], s[1], VersionRange.createFromVersion( s[2] ),
+ type, classifier, Artifact.SCOPE_RUNTIME );
- bundleArtifacts.add( artifact );
+ artifactResolver.resolve( artifact, remoteArtifactRepositories, localRepository );
+
+ artifactFile = artifact.getFile();
+ }
+ bundleArtifacts.add( artifactFile );
}
}
- catch ( DownloadException e )
+ catch ( ArtifactResolutionException e )
{
- throw new MojoExecutionException( "Error downloading resources JAR.", e );
+ throw new MojoExecutionException( "Error downloading resources archive.", e );
}
- catch ( DownloadNotFoundException e )
+ catch ( ArtifactNotFoundException e )
{
- throw new MojoExecutionException( "Resources JAR cannot be found.", e );
+ throw new MojoExecutionException( "Resources archive cannot be found.", e );
}
return bundleArtifacts;
Modified: maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java?rev=1229389&r1=1229388&r2=1229389&view=diff
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java (original)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java Mon Jan 9 22:10:40 2012
@@ -134,6 +134,76 @@ public class RemoteResourcesMojoTest
assertTrue( file.exists() );
}
+ public void testSimpleBundlesWithType()
+ throws Exception
+ {
+ final MavenProjectResourcesStub project = createTestProject( "default-simplebundles" );
+ final ProcessRemoteResourcesMojo mojo = lookupProcessMojoWithSettings( project ,
+ new String[] {
+ "test:test:1.0:war"
+ } );
+
+ setupDefaultProject( project );
+
+ ArtifactRepository repo = (ArtifactRepository) getVariableValueFromObject( mojo, "localRepository" );
+ String path = repo.pathOf( new DefaultArtifact( "test",
+ "test",
+ VersionRange.createFromVersion( "1.0" ),
+ null,
+ "war",
+ "",
+ new DefaultArtifactHandler() ) );
+
+ File file = new File( repo.getBasedir() + "/" + path + ".war" );
+ file.getParentFile().mkdirs();
+ buildResourceBundle( "default-simplebundles-create",
+ null,
+ new String[] { "SIMPLE.txt" },
+ file );
+
+
+ mojo.execute();
+
+ file = (File) getVariableValueFromObject( mojo, "outputDirectory" );
+ file = new File( file, "SIMPLE.txt" );
+ assertTrue( file.exists() );
+ }
+
+ public void testSimpleBundlesWithClassifier()
+ throws Exception
+ {
+ final MavenProjectResourcesStub project = createTestProject( "default-simplebundles" );
+ final ProcessRemoteResourcesMojo mojo = lookupProcessMojoWithSettings( project ,
+ new String[] {
+ "test:test:1.0:jar:test"
+ } );
+
+ setupDefaultProject( project );
+
+ ArtifactRepository repo = (ArtifactRepository) getVariableValueFromObject( mojo, "localRepository" );
+ String path = repo.pathOf( new DefaultArtifact( "test",
+ "test",
+ VersionRange.createFromVersion( "1.0" ),
+ null,
+ "jar",
+ "test",
+ new DefaultArtifactHandler() ) );
+
+ File file = new File( repo.getBasedir() + "/" + path + ".jar" );
+ file.getParentFile().mkdirs();
+ buildResourceBundle( "default-simplebundles-create",
+ null,
+ new String[] { "SIMPLE.txt" },
+ file );
+
+
+ mojo.execute();
+
+ file = (File) getVariableValueFromObject( mojo, "outputDirectory" );
+ file = new File( file, "SIMPLE.txt" );
+ assertTrue( file.exists() );
+ }
+
public void testVelocityUTF8()
throws Exception
{
Added: maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT_GenerateFromBundleWithTypeAndClassifier.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT_GenerateFromBundleWithTypeAndClassifier.java?rev=1229389&view=auto
==============================================================================
--- maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT_GenerateFromBundleWithTypeAndClassifier.java (added)
+++ maven/plugins/trunk/maven-remote-resources-plugin/src/test/java/org/apache/maven/plugin/resources/remote/it/IT_GenerateFromBundleWithTypeAndClassifier.java Mon Jan 9 22:10:40 2012
@@ -0,0 +1,51 @@
+package org.apache.maven.plugin.resources.remote.it;
+
+/*
+ * 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.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 IT_GenerateFromBundleWithTypeAndClassifier
+ extends AbstractIT
+{
+
+ public void test()
+ throws IOException, URISyntaxException, VerificationException
+ {
+ File dir = TestUtils.getTestDir( "generate-from-bundle-with-type-and-classifier" );
+ 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 );
+ }
+
+}