You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2023/01/07 17:31:42 UTC

[maven-enforcer] branch master updated: [MENFORCER-378] Regression for non existing optional dependency

This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git


The following commit(s) were added to refs/heads/master by this push:
     new 7e14899  [MENFORCER-378] Regression for non existing optional dependency
7e14899 is described below

commit 7e14899b6627ae3c26ed0726811ac86360f2d4a7
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Sat Jan 7 17:51:31 2023 +0100

    [MENFORCER-378] Regression for non existing optional dependency
---
 .../non-exeisting-optional-dependency/pom.xml      | 67 ++++++++++++++++++++++
 .../verify.groovy                                  | 30 ++++++++++
 2 files changed, 97 insertions(+)

diff --git a/maven-enforcer-plugin/src/it/projects/non-exeisting-optional-dependency/pom.xml b/maven-enforcer-plugin/src/it/projects/non-exeisting-optional-dependency/pom.xml
new file mode 100644
index 0000000..6b852fc
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/non-exeisting-optional-dependency/pom.xml
@@ -0,0 +1,67 @@
+<?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>test</artifactId>
+  <version>1.0</version>
+
+  <description>Optional non existing dependencies should not break build</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.example</groupId>
+      <artifactId>test-not-existing</artifactId>
+      <version>1.0</version>
+      <optional>true</optional>
+    </dependency>
+  </dependencies>
+
+  <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>
+                <alwaysPass />
+                <banTransitiveDependencies />
+                <bannedDependencies />
+                <dependencyConvergence />
+                <requireReleaseDeps />
+                <requireUpperBoundDeps />
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-enforcer-plugin/src/it/projects/non-exeisting-optional-dependency/verify.groovy b/maven-enforcer-plugin/src/it/projects/non-exeisting-optional-dependency/verify.groovy
new file mode 100644
index 0000000..4e8a492
--- /dev/null
+++ b/maven-enforcer-plugin/src/it/projects/non-exeisting-optional-dependency/verify.groovy
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+def buildLog = new File( basedir, 'build.log' ).text
+
+// only warning about missing dependencies
+assert buildLog.contains( '[WARNING] The POM for org.example:test-not-existing:jar:1.0 is missing, no dependency information available' )
+
+// rule executed
+assert buildLog.contains( '[INFO] Rule 0: org.apache.maven.plugins.enforcer.AlwaysPass executed' )
+assert buildLog.contains( '[INFO] Rule 1: org.apache.maven.plugins.enforcer.BanTransitiveDependencies executed' )
+assert buildLog.contains( '[INFO] Rule 2: org.apache.maven.plugins.enforcer.BannedDependencies executed' )
+assert buildLog.contains( '[INFO] Rule 3: org.apache.maven.plugins.enforcer.DependencyConvergence executed')
+assert buildLog.contains( '[INFO] Rule 4: org.apache.maven.plugins.enforcer.RequireReleaseDeps executed')
+assert buildLog.contains( '[INFO] Rule 5: org.apache.maven.plugins.enforcer.RequireUpperBoundDeps executed')