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/10/27 17:08:28 UTC
svn commit: r1402804 - in /maven/plugins/trunk/maven-invoker-plugin/src:
it/invocation-cmdline-exclude/ it/invocation-cmdline-exclude/src/
it/invocation-cmdline-exclude/src/it/
it/invocation-cmdline-exclude/src/it/minvoker-140/
main/java/org/apache/mav...
Author: rfscholte
Date: Sat Oct 27 15:08:28 2012
New Revision: 1402804
URL: http://svn.apache.org/viewvc?rev=1402804&view=rev
Log:
[MINVOKER-140] Support exclusion with invokerTest
Added:
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/pom.xml
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/src/
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/src/it/
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/src/it/minvoker-140/
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml
maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/test.properties
Modified:
maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java
Added: maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/pom.xml?rev=1402804&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/pom.xml Sat Oct 27 15:08:28 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>
+
+ <groupId>org.apache.maven.plugins.invoker.its</groupId>
+ <artifactId>invocation-cmdline-exclude</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <description>Test if the exclude can be used from commandline</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <debug>true</debug>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml?rev=1402804&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml Sat Oct 27 15:08:28 2012
@@ -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>
+ <groupId>org.apache.maven.plugins.invoker.its</groupId>
+ <artifactId>minvoker-138</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <AlwaysFail/>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/test.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/test.properties?rev=1402804&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/test.properties (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/invocation-cmdline-exclude/test.properties Sat Oct 27 15:08:28 2012
@@ -0,0 +1 @@
+invoker.test = !minvoker-140
\ No newline at end of file
Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java?rev=1402804&r1=1402803&r2=1402804&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java Sat Oct 27 15:08:28 2012
@@ -353,14 +353,16 @@ public abstract class AbstractInvokerMoj
private MavenProject project;
/**
- * A comma separated list of project names to run. Specify this parameter to run individual tests by file name,
+ * A comma separated list of projectname patterns to run. Specify this parameter to run individual tests by file name,
* overriding the {@link #setupIncludes}, {@link #pomIncludes} and {@link #pomExcludes} parameters. Each pattern you
- * specify here will be used to create an include pattern formatted like
- * <code>${projectsDirectory}/<i>pattern</i></code>, so you can just type
- * <code>-Dinvoker.test=FirstTest,SecondTest</code> to run builds in <code>${projectsDirectory}/FirstTest</code> and
- * <code>${projectsDirectory}/SecondTest</code>.
+ * specify here will be used to create an include/exclude pattern formatted like
+ * <code>${projectsDirectory}/<i>pattern</i></code>. To exclude a test, prefix the pattern with a '<code>!</code>'.
+ * So you can just type
+ * <nobr><code>-Dinvoker.test=SimpleTest,Comp*Test,!Compare*</code></nobr> to run builds in
+ * <code>${projectsDirectory}/SimpleTest</code> and
+ * <code>${projectsDirectory}/ComplexTest</code>, but not <code>${projectsDirectory}/CompareTest</code>
*
- * @since 1.1
+ * @since 1.1 (exclusion since 1.8)
*/
@Parameter( property = "invoker.test" )
private String invokerTest;
@@ -1714,16 +1716,24 @@ public abstract class AbstractInvokerMoj
{
String[] testRegexes = StringUtils.split( invokerTest, "," );
List<String> includes = new ArrayList<String>( testRegexes.length );
+ List<String> excludes = new ArrayList<String>();
- for ( int i = 0, size = testRegexes.length; i < size; i++ )
+ for ( String regex : testRegexes )
{
// user just use -Dinvoker.test=MWAR191,MNG111 to use a directory thats the end is not pom.xml
- includes.add( testRegexes[i] );
+ if ( regex.startsWith( "!" ) )
+ {
+ excludes.add( regex.substring( 1 ) );
+ }
+ else
+ {
+ includes.add( regex );
+ }
}
// it would be nice if we could figure out what types these are... but perhaps
// not necessary for the -Dinvoker.test=xxx t
- buildJobs = scanProjectsDirectory( includes, null, BuildJob.Type.DIRECT );
+ buildJobs = scanProjectsDirectory( includes, excludes, BuildJob.Type.DIRECT );
}
else
{