You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by da...@apache.org on 2010/01/01 09:33:30 UTC
svn commit: r894979 - in /maven/plugins/trunk/maven-dependency-plugin:
pom.xml src/it/copy-dependencies/pom.xml
src/it/copy-dependencies/validate.bsh
src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java
Author: dantran
Date: Fri Jan 1 08:33:29 2010
New Revision: 894979
URL: http://svn.apache.org/viewvc?rev=894979&view=rev
Log:
[MDEP-193] use maven-common-artifact-filters-1.2 to excludeClassifers and includesClassifers to work. IT added
Modified:
maven/plugins/trunk/maven-dependency-plugin/pom.xml
maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/pom.xml
maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/validate.bsh
maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java
Modified: maven/plugins/trunk/maven-dependency-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/pom.xml?rev=894979&r1=894978&r2=894979&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/pom.xml Fri Jan 1 08:33:29 2010
@@ -187,7 +187,7 @@
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-common-artifact-filters</artifactId>
- <version>1.0</version>
+ <version>1.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
Modified: maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/pom.xml?rev=894979&r1=894978&r2=894979&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/pom.xml (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/pom.xml Fri Jan 1 08:33:29 2010
@@ -1,26 +1,17 @@
<?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.
+ <!--
+ ~ 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">
+<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.its.dependency</groupId>
@@ -32,31 +23,68 @@
Test dependency:copy-dependencies
</description>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
-
+
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>2.0.6</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0.6</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0.6</version>
+ <classifier>javadoc</classifier>
+ </dependency>
</dependencies>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
<build>
+
+ <defaultGoal>package</defaultGoal>
+
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>@project.version@</version>
<executions>
<execution>
- <id>test</id>
+ <id>test-1</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <copyPom>true</copyPom>
+ <outputDirectory>${project.build.directory}/it/copy-dep-test-1</outputDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>test-2</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <excludeClassifiers>sources,javadoc</excludeClassifiers>
+ <outputDirectory>${project.build.directory}/it/copy-dep-test-2</outputDirectory>
+ </configuration>
+ </execution>
+ <execution>
+ <id>test-3</id>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
- <copyPom>true</copyPom>
+ <includeClassifiers>sources</includeClassifiers>
+ <outputDirectory>${project.build.directory}/it/copy-dep-test-3</outputDirectory>
</configuration>
</execution>
</executions>
Modified: maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/validate.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/validate.bsh?rev=894979&r1=894978&r2=894979&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/validate.bsh (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/it/copy-dependencies/validate.bsh Fri Jan 1 08:33:29 2010
@@ -1,12 +1,14 @@
import java.io.*;
-File libDir = new File( basedir, "target/dependency" );
+File libDir = new File( basedir, "target/it/copy-dep-test-1" );
String[] expectedFiles = {
"maven-model-2.0.6.jar",
"maven-model-2.0.6.pom",
"plexus-utils-1.4.1.jar",
"plexus-utils-1.4.1.pom",
+ "maven-model-2.0.6-sources.jar",
+ "maven-model-2.0.6-javadoc.jar",
};
for ( String expectedFile : expectedFiles )
@@ -19,4 +21,73 @@
}
}
+libDir = new File( basedir, "target/it/copy-dep-test-2" );
+
+String [] expectedFiles2 = {
+ "maven-model-2.0.6.jar",
+ "plexus-utils-1.4.1.jar",
+};
+
+String [] unexpectedFiles2 = {
+ "plexus-utils-1.4.1.pom",
+ "maven-model-2.0.6.pom",
+ "maven-model-2.0.6-sources.jar",
+ "maven-model-2.0.6-javadoc.jar",
+};
+
+for ( String expectedFile : expectedFiles2 )
+{
+ File file = new File( libDir, expectedFile );
+ System.out.println( "Checking for existence of " + file );
+ if ( !file.isFile() )
+ {
+ throw new Exception( "Missing file " + file );
+ }
+}
+
+for ( String unexpectedFile : unexpectedFiles2 )
+{
+ File file = new File( libDir, unexpectedFile );
+ System.out.println( "Checking for existence of " + file );
+ if ( file.isFile() )
+ {
+ throw new Exception( "Unexpected file " + file + " found" );
+ }
+}
+
+libDir = new File( basedir, "target/it/copy-dep-test-3" );
+
+String [] expectedFiles3 = {
+ "maven-model-2.0.6-sources.jar",
+};
+
+String [] unexpectedFiles3 = {
+ "plexus-utils-1.4.1.pom",
+ "maven-model-2.0.6.pom",
+ "maven-model-2.0.6-javadoc.jar",
+ "maven-model-2.0.6.jar",
+ "plexus-utils-1.4.1.jar",
+};
+
+for ( String expectedFile : expectedFiles3 )
+{
+ File file = new File( libDir, expectedFile );
+ System.out.println( "Checking for existence of " + file );
+ if ( !file.isFile() )
+ {
+ throw new Exception( "Missing file " + file );
+ }
+}
+
+for ( String unexpectedFile : unexpectedFiles3 )
+{
+ File file = new File( libDir, unexpectedFile );
+ System.out.println( "Checking for existence of " + file );
+ if ( file.isFile() )
+ {
+ throw new Exception( "Unexpected file " + file + " found" );
+ }
+}
+
+
return true;
Modified: maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java?rev=894979&r1=894978&r2=894979&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractDependencyFilterMojo.java Fri Jan 1 08:33:29 2010
@@ -35,8 +35,8 @@
import org.apache.maven.shared.artifact.filter.collection.ClassifierFilter;
import org.apache.maven.shared.artifact.filter.collection.FilterArtifacts;
import org.apache.maven.shared.artifact.filter.collection.GroupIdFilter;
+import org.apache.maven.shared.artifact.filter.collection.ProjectTransitivityFilter;
import org.apache.maven.shared.artifact.filter.collection.ScopeFilter;
-import org.apache.maven.shared.artifact.filter.collection.TransitivityFilter;
import org.apache.maven.shared.artifact.filter.collection.TypeFilter;
import org.codehaus.plexus.util.StringUtils;
@@ -243,7 +243,7 @@
// add filters in well known order, least specific to most specific
FilterArtifacts filter = new FilterArtifacts();
- filter.addFilter( new TransitivityFilter( project.getDependencyArtifacts(), this.excludeTransitive ) );
+ filter.addFilter( new ProjectTransitivityFilter( project.getDependencyArtifacts(), this.excludeTransitive ) );
filter.addFilter( new ScopeFilter( this.includeScope, this.excludeScope ) );
filter.addFilter( new TypeFilter( this.includeTypes, this.excludeTypes ) );
filter.addFilter( new ClassifierFilter( this.includeClassifiers, this.excludeClassifiers ) );