You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2015/02/24 20:11:38 UTC

svn commit: r1662085 - in /maven/enforcer/trunk: enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/ maven-enforcer-plugin/src/it/projects/banned-dependencie...

Author: khmarbaise
Date: Tue Feb 24 19:11:38 2015
New Revision: 1662085

URL: http://svn.apache.org/r1662085
Log:
[MENFORCER-224] Regression from 1.3.1 to 1.4 with bannedDependencies rule
 Patch of Brian Jackson applied.

Added:
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange/
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/invoker.properties
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/pom.xml
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/verify.groovy
    maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange/pom.xml
Modified:
    maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java

Modified: maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java?rev=1662085&r1=1662084&r2=1662085&view=diff
==============================================================================
--- maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java (original)
+++ maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/utils/ArtifactMatcher.java Tue Feb 24 19:11:38 2015
@@ -137,7 +137,8 @@ public final class ArtifactMatcher
         private boolean matches( String expression, String input )
         {
             String regex =
-                expression.replace( ".", "\\." ).replace( "*", ".*" ).replace( ":", "\\:" ).replace( '?', '.' );
+                    expression.replace( ".", "\\." ).replace( "*", ".*" ).replace( ":", "\\:" ).replace( '?', '.' )
+                            .replace( "[", "\\[" ).replace( "]", "\\]" ).replace( "(", "\\(" ).replace( ")", "\\)" );
 
             // TODO: Check if this can be done better or prevented earlier.
             if ( input == null )

Added: maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/invoker.properties
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/invoker.properties?rev=1662085&view=auto
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/invoker.properties (added)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/invoker.properties Tue Feb 24 19:11:38 2015
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.buildResult = failure

Added: maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/pom.xml
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/pom.xml?rev=1662085&view=auto
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/pom.xml (added)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/pom.xml Tue Feb 24 19:11:38 2015
@@ -0,0 +1,74 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>menforcer72</artifactId>
+  <version>1.0</version>
+
+  <description>
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <bannedDependencies>
+                  <excludes>
+                    <exclude>org.apache.maven.plugins.enforcer.its:menforcer72_junit:[3.8,4.0):jar</exclude>
+                    <exclude>org.apache.maven.plugins.enforcer.its:menforcer72_logging:[1.0,2.0)</exclude>
+                  </excludes>
+                </bannedDependencies>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer72_logging</artifactId>
+      <version>1.1.1</version>
+      <type>pom</type>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer72_junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Added: maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/verify.groovy
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/verify.groovy?rev=1662085&view=auto
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/verify.groovy (added)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange-fail/verify.groovy Tue Feb 24 19:11:38 2015
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+File buildLog = new File( basedir, 'build.log' )
+assert buildLog.text.contains( '[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:' )
+ 
\ No newline at end of file

Added: maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange/pom.xml
URL: http://svn.apache.org/viewvc/maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange/pom.xml?rev=1662085&view=auto
==============================================================================
--- maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange/pom.xml (added)
+++ maven/enforcer/trunk/maven-enforcer-plugin/src/it/projects/banned-dependencies-versionrange/pom.xml Tue Feb 24 19:11:38 2015
@@ -0,0 +1,76 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.enforcer</groupId>
+  <artifactId>menforcer72</artifactId>
+  <version>1.0</version>
+
+  <description>
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>test</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <bannedDependencies>
+                  <excludes>
+                    <exclude>org.apache.maven.plugins.enforcer.its:menforcer72_junit:[3.8,4.0):jar</exclude>
+                  </excludes>
+                  <includes>
+                    <include>org.apache.maven.plugins.enforcer.its:menforcer72_junit:[3.8,4.0):*:test</include>
+                  </includes>
+                </bannedDependencies>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer72_logging</artifactId>
+      <version>1.1.1</version>
+      <type>pom</type>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugins.enforcer.its</groupId>
+      <artifactId>menforcer72_junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>