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

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


The following commit(s) were added to refs/heads/master by this push:
     new 07ab883e3 [MNG-8331] Demonstrate the problem with disappearing 
dependencies
07ab883e3 is described below

commit 07ab883e329b1ced32bf3bac77498f6af39cddb7
Author: Maarten Mulders <mthmuld...@apache.org>
AuthorDate: Fri Oct 18 20:47:56 2024 +0200

    [MNG-8331] Demonstrate the problem with disappearing dependencies
    
    Closes 393.
---
 ...331VersionedAndUnversionedDependenciesTest.java | 58 ++++++++++++++++++++++
 .../org/apache/maven/it/TestSuiteOrdering.java     |  1 +
 .../.mvn/maven.config                              |  0
 .../module-a/pom.xml                               | 11 ++++
 .../module-b/pom.xml                               | 25 ++++++++++
 .../org/apache/maven/its/deps/ExampleTest.java     | 26 ++++++++++
 .../pom.xml                                        | 44 ++++++++++++++++
 7 files changed, 165 insertions(+)

diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8331VersionedAndUnversionedDependenciesTest.java
 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8331VersionedAndUnversionedDependenciesTest.java
new file mode 100644
index 000000000..c522fd1d1
--- /dev/null
+++ 
b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8331VersionedAndUnversionedDependenciesTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package org.apache.maven.it;
+
+import java.io.File;
+
+import org.apache.maven.shared.verifier.Verifier;
+import org.apache.maven.shared.verifier.util.ResourceExtractor;
+import org.junit.jupiter.api.Test;
+
+/**
+ * This is a test set for <a 
href="https://issues.apache.org/jira/browse/MNG-8331";>MNG-8331</a>.
+ * <p>
+ * When a project that uses modelVersion 4.1.0 had both dependencies with a 
<pre>version</pre> element and dependencies
+ * without a <pre>version</pre> element, for which the version could be found 
elsewhere in the same aggregator project,
+ * the <pre>DefaultModelBuilder</pre> would enrich the dependencies without a 
<pre>version</pre> element.
+ * The dependencies that did have a <pre>version</pre> element would not be 
copied over into the new <pre>Model</pre>
+ * instance.
+ */
+class MavenITmng8331VersionedAndUnversionedDependenciesTest extends 
AbstractMavenIntegrationTestCase {
+
+    MavenITmng8331VersionedAndUnversionedDependenciesTest() {
+        super("[4.0.0-beta-5,)");
+    }
+
+    /**
+     * Since the dependency on junit-jupiter-api had a version, it was added 
to the project. The dependency on module-a
+     * did not have a version, but could be found in the same multi-module 
project. As a result, the dependency on
+     * junit-jupiter-api was not present in the model (see class-level 
JavaDoc) which would cause the test-compile
+     * to fail.
+     */
+    @Test
+    void allDependenciesArePresentInTheProject() throws Exception {
+        File testDir = ResourceExtractor.simpleExtractResources(getClass(), 
"/mng-8331-versioned-and-unversioned-deps");
+
+        Verifier verifier = new Verifier(testDir.getAbsolutePath());
+        verifier.setLogFileName("allDependenciesArePresentInTheProject.txt");
+        verifier.executeGoal("test-compile");
+
+        verifier.verifyErrorFreeLog();
+    }
+}
diff --git 
a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java 
b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
index b78e12433..0acda4fdc 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/TestSuiteOrdering.java
@@ -120,6 +120,7 @@ public class TestSuiteOrdering implements ClassOrderer {
          * the tests are to finishing. Newer tests are also more likely to 
fail, so this is
          * a fail fast technique as well.
          */
+        
suite.addTestSuite(MavenITmng8331VersionedAndUnversionedDependenciesTest.class);
         suite.addTestSuite(MavenITmng8299CustomLifecycleTest.class);
         
suite.addTestSuite(MavenITmng7982DependencyManagementTransitivityTest.class);
         suite.addTestSuite(MavenITmng8294ParentChecksTest.class);
diff --git 
a/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/.mvn/maven.config
 
b/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/.mvn/maven.config
new file mode 100644
index 000000000..e69de29bb
diff --git 
a/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/module-a/pom.xml
 
b/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/module-a/pom.xml
new file mode 100644
index 000000000..1fe9c4fd4
--- /dev/null
+++ 
b/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/module-a/pom.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.1.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 
https://maven.apache.org/xsd/maven-4.1.0-beta-4.xsd";>
+  <parent>
+    <groupId>org.apache.maven.its</groupId>
+    <artifactId>mng8331</artifactId>
+    <version>1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>module-a</artifactId>
+  <packaging>jar</packaging>
+</project>
diff --git 
a/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/module-b/pom.xml
 
b/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/module-b/pom.xml
new file mode 100644
index 000000000..8597b9536
--- /dev/null
+++ 
b/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/module-b/pom.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.1.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 
https://maven.apache.org/xsd/maven-4.1.0-beta-4.xsd";>
+  <parent>
+    <groupId>org.apache.maven.its</groupId>
+    <artifactId>mng8331</artifactId>
+    <version>1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>module-b</artifactId>
+  <packaging>jar</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven.its</groupId>
+      <artifactId>module-a</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-api</artifactId>
+      <version>5.11.0</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
diff --git 
a/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/module-b/src/test/java/org/apache/maven/its/deps/ExampleTest.java
 
b/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/module-b/src/test/java/org/apache/maven/its/deps/ExampleTest.java
new file mode 100644
index 000000000..121238123
--- /dev/null
+++ 
b/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/module-b/src/test/java/org/apache/maven/its/deps/ExampleTest.java
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.apache.maven.its.deps;
+
+import org.junit.jupiter.api.Test;
+
+class ExampleTest {
+    @Test
+    void example() {}
+}
diff --git 
a/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/pom.xml
 
b/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/pom.xml
new file mode 100644
index 000000000..334128747
--- /dev/null
+++ 
b/core-it-suite/src/test/resources/mng-8331-versioned-and-unversioned-deps/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.1.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 
https://maven.apache.org/xsd/maven-4.1.0-beta-4.xsd";>
+  <groupId>org.apache.maven.its</groupId>
+  <artifactId>mng8331</artifactId>
+  <version>1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <modules>
+    <module>module-a</module>
+    <module>module-b</module>
+  </modules>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <maven.compiler.release>11</maven.compiler.release>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.13.0</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-jar-plugin</artifactId>
+          <version>3.4.2</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-resources-plugin</artifactId>
+          <version>3.3.1</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>3.5.1</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

Reply via email to