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 16:52:11 UTC

[maven-enforcer] branch MENFORCER-378 created (now 9a1bb1a)

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

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


      at 9a1bb1a  [MENFORCER-378] Regression for non existing optional dependency

This branch includes the following new commits:

     new 9a1bb1a  [MENFORCER-378] Regression for non existing optional dependency

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-enforcer] 01/01: [MENFORCER-378] Regression for non existing optional dependency

Posted by sj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 9a1bb1aecfa1ed20836e3d60b0138ae38e07e8ed
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')