Author: pgier
Date: Thu May 20 20:26:55 2010
New Revision: 946778
URL: http://svn.apache.org/viewvc?rev=946778&view=rev
Log:
[SUREFIRE-576] Fix scope filtering and use pattern filter for dependency filter.
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.java
(with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/pom.xml
(with props)
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java
(with props)
Modified:
maven/surefire/trunk/maven-surefire-common/pom.xml
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-filtering/pom.xml
Modified: maven/surefire/trunk/maven-surefire-common/pom.xml
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/pom.xml?rev=946778&r1=946777&r2=946778&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/pom.xml (original)
+++ maven/surefire/trunk/maven-surefire-common/pom.xml Thu May 20 20:26:55 2010
@@ -71,6 +71,11 @@
<artifactId>maven-toolchain</artifactId>
<version>2.0.9</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-common-artifact-filters</artifactId>
+ <version>1.2</version>
+ </dependency>
</dependencies>
<profiles>
Modified:
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java?rev=946778&r1=946777&r2=946778&view=diff
==============================================================================
---
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
(original)
+++
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
Thu May 20 20:26:55 2010
@@ -15,7 +15,7 @@ import org.apache.maven.artifact.version
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
import org.apache.maven.surefire.booter.ForkConfiguration;
import org.apache.maven.surefire.booter.SurefireBooter;
import org.apache.maven.surefire.report.BriefConsoleReporter;
@@ -532,7 +532,7 @@ public abstract class AbstractSurefireMo
if ( getClasspathDependencyExcludes() != null )
{
- ArtifactFilter dependencyFilter = new ExcludesArtifactFilter(
getClasspathDependencyExcludes() );
+ ArtifactFilter dependencyFilter = new
PatternIncludesArtifactFilter( getClasspathDependencyExcludes() );
classpathArtifacts = this.filterArtifacts( classpathArtifacts,
dependencyFilter );
}
@@ -575,7 +575,7 @@ public abstract class AbstractSurefireMo
for ( Iterator iter = artifacts.iterator(); iter.hasNext(); )
{
Artifact artifact = (Artifact) iter.next();
- if ( filter.include( artifact ) )
+ if ( ! filter.include( artifact ) )
{
filteredArtifacts.add( artifact );
}
Modified:
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?rev=946778&r1=946777&r2=946778&view=diff
==============================================================================
---
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
(original)
+++
maven/surefire/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
Thu May 20 20:26:55 2010
@@ -133,14 +133,11 @@ public class SurefirePlugin
/**
* A dependency scope to exclude from the test classpath
- * The scope should be one of the scopes defined by
org.apache.maven.artifact.Artifact.
- * This includes the following
+ * The scope can be one of the following scopes:
*
* <ul>
* <li><i>compile</i> - system, provided, compile
* <li><i>runtime</i> - compile, runtime
- * <li><i>compile+runtime</i> - system, provided, compile, runtime
- * <li><i>runtime+system</i> - system, compile, runtime
* <li><i>test</i> - system, provided, compile, runtime, test
* </ul>
*
Modified:
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm?rev=946778&r1=946777&r2=946778&view=diff
==============================================================================
---
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
(original)
+++
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/configuring-classpath.apt.vm
Thu May 20 20:26:55 2010
@@ -86,10 +86,6 @@ Removing Dependency Classpath Elements
* <<runtime>> - compile, runtime
- * <<compile+runtime>> - system, provided, compile, runtime
-
- * <<runtime+system>> - system, compile, runtime
-
* <<test>> - system, provided, compile, runtime, test
+---+
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.java?rev=946778&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.java
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.java
Thu May 20 20:26:55 2010
@@ -0,0 +1,47 @@
+package org.apache.maven.surefire.its;
+/*
+ * 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.Verifier;
+import org.apache.maven.it.util.ResourceExtractor;
+
+import java.io.File;
+
+/**
+ * Test additionalClasspathElements
+ *
+ * @author pgier
+ */
+public class ClasspathScopeFilteringIT
+ extends AbstractSurefireIntegrationTestClass
+{
+ public void testAdditionalClasspath()
+ throws Exception
+ {
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(),
"/classpath-scope-filtering" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+ this.executeGoal( verifier, "test" );
+ verifier.verifyErrorFreeLog();
+ verifier.resetStreams();
+
+ HelperAssertions.assertTestSuiteResults( 1, 0, 0, 0, testDir );
+ }
+}
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/ClasspathScopeFilteringIT.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-filtering/pom.xml
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-filtering/pom.xml?rev=946778&r1=946777&r2=946778&view=diff
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-filtering/pom.xml
(original)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-filtering/pom.xml
Thu May 20 20:26:55 2010
@@ -24,9 +24,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.plugins.surefire</groupId>
- <artifactId>additional-classpath</artifactId>
+ <artifactId>classpath-dependency-filter</artifactId>
<version>1.0-SNAPSHOT</version>
- <name>Test for additionalClasspathElements</name>
+ <name>Test for filtering classpath dependencies</name>
<build>
<plugins>
@@ -35,7 +35,7 @@
<version>${surefire.version}</version>
<configuration>
<classpathDependencyExcludes>
- <exclude>org.apache.commons:commons-email</exclude>
+ <exclude>org.apache.commons:*</exclude>
</classpathDependencyExcludes>
</configuration>
</plugin>
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/pom.xml
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/pom.xml?rev=946778&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/pom.xml
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/pom.xml
Thu May 20 20:26:55 2010
@@ -0,0 +1,57 @@
+<?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.plugins.surefire</groupId>
+ <artifactId>classpath-scope-filter</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Test for classpath scope filter</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <configuration>
+
<classpathDependencyScopeExclude>compile</classpathDependencyScopeExclude>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-email</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java
URL:
http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java?rev=946778&view=auto
==============================================================================
---
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java
(added)
+++
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java
Thu May 20 20:26:55 2010
@@ -0,0 +1,25 @@
+package classpathFiltering;
+
+import junit.framework.TestCase;
+
+public class BasicTest
+ extends TestCase
+{
+
+ public void testDependencyFilter() {
+
+ Class testClass = null;
+ String testClassName = "org.apache.commons.mail.Email";
+ try
+ {
+ testClass = Class.forName( testClassName );
+ System.out.println( "Able to load class " + testClass );
+ }
+ catch ( ClassNotFoundException e )
+ {
+ System.out.println( "Couldn't load " + testClassName );
+ }
+ assertNull( testClass );
+ }
+
+}
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java
------------------------------------------------------------------------------
svn:executable = *
Propchange:
maven/surefire/trunk/surefire-integration-tests/src/test/resources/classpath-scope-filtering/src/test/java/classpathFiltering/BasicTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision