From 5464c343f9a93688ac64a5b8465affe4d8a3b3f8 Mon Sep 17 00:00:00 2001 From: Tamas Cservenak Date: Tue, 29 Oct 2024 14:23:53 +0100 Subject: [PATCH] [MNG-8340] IT Creates error message with beta-5 like: ``` [INFO] --- shade:3.5.0:shade (shade) @ child1 --- [INFO] Including org.slf4j:slf4j-api:jar:2.0.16 in the shaded jar. [INFO] Dependency-reduced POM written at: /home/cstamas/Worx/apache-maven/maven-integration-testing/core-it-suite/target/test-classes/mng-8340/child1/target/dr-pom.xml [WARNING] The top project (/home/cstamas/Worx/apache-maven/maven-integration-testing/core-it-suite/target/test-classes/mng-8340/child1/target/dr-pom.xml) cannot be found in the reactor from root project (/home/cstamas/Worx/apache-maven/maven-integration-testing/pom.xml). Make sure the root directory is correct (a missing '.mvn' directory in the root project is the most common cause) and the project is correctly included in the reactor (missing activated profiles, command line options, etc.). For this build, the top project will be used as the root project. [WARNING] The top project (/home/cstamas/Worx/apache-maven/maven-integration-testing/core-it-suite/target/test-classes/mng-8340/pom.xml) cannot be found in the reactor from root project (/home/cstamas/Worx/apache-maven/maven-integration-testing/pom.xml). Make sure the root directory is correct (a missing '.mvn' directory in the root project is the most common cause) and the project is correctly included in the reactor (missing activated profiles, command line options, etc.). For this build, the top project will be used as the root project. [WARNING] child1-1.0.0.jar, slf4j-api-2.0.16.jar define 1 overlapping resource: [WARNING] - META-INF/MANIFEST.MF [WARNING] maven-shade-plugin has detected that some files are [WARNING] present in two or more JARs. When this happens, only one [WARNING] single version of the file is copied to the uber jar. [WARNING] Usually this is not harmful and you can skip these warnings, [WARNING] otherwise try to manually exclude artifacts based on [WARNING] mvn dependency:tree -Ddetail=true and the above output. [WARNING] See https://maven.apache.org/plugins/maven-shade-plugin/ [INFO] Replacing original artifact with shaded artifact. [INFO] Replacing /home/cstamas/Worx/apache-maven/maven-integration-testing/core-it-suite/target/test-classes/mng-8340/child1/target/child1-1.0.0.jar with /home/cstamas/Worx/apache-maven/maven-integration-testing/core-it-suite/target/test-classes/mng-8340/child1/target/child1-1.0.0-shaded.jar [INFO] Copying org.apache.maven.it.mng8340:child1:pom:1.0.0 to project local repository [INFO] Copying org.apache.maven.it.mng8340:child1:jar:1.0.0 to project local repository [WARNING] Failed to notify spy org.apache.maven.ReactorReader$ReactorReaderSpy: 1 problem was for org.apache.maven.it.mng8340:child1:jar:1.0.0 - [FATAL] 'parent.relativePath' points at '../../pom.xml' but no POM could be found, please verify your project structure @ line 3, column 3 ``` --- ...avenITmng8340GeneratedPomInTargetTest.java | 48 +++++++++++++++++++ .../apache/maven/it/TestSuiteOrdering.java | 1 + .../test/resources/mng-8340/child1/pom.xml | 42 ++++++++++++++++ .../test/resources/mng-8340/child2/pom.xml | 21 ++++++++ .../src/test/resources/mng-8340/pom.xml | 15 ++++++ 5 files changed, 127 insertions(+) create mode 100644 core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8340GeneratedPomInTargetTest.java create mode 100644 core-it-suite/src/test/resources/mng-8340/child1/pom.xml create mode 100644 core-it-suite/src/test/resources/mng-8340/child2/pom.xml create mode 100644 core-it-suite/src/test/resources/mng-8340/pom.xml diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8340GeneratedPomInTargetTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8340GeneratedPomInTargetTest.java new file mode 100644 index 000000000..c121e583b --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8340GeneratedPomInTargetTest.java @@ -0,0 +1,48 @@ +/* + * 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 MNG-8340. + */ +class MavenITmng8340GeneratedPomInTargetTest extends AbstractMavenIntegrationTestCase { + + MavenITmng8340GeneratedPomInTargetTest() { + super("[3.8.6,)"); + } + + /** + * Verify that the build succeeds. + */ + @Test + void testProjectWithShadePluginAndGeneratedPomUnderTarget() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8340"); + + Verifier verifier = newVerifier(testDir.getAbsolutePath()); + verifier.addCliArgument("package"); + verifier.execute(); + 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 e864606d7..4bf5b649e 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 TestSuiteOrdering() { * the tests are to finishing. Newer tests are also more likely to fail, so this is * a fail fast technique as well. */ + suite.addTestSuite(MavenITmng8340GeneratedPomInTargetTest.class); suite.addTestSuite(MavenITmng8360SubprojectProfileActivationTest.class); suite.addTestSuite(MavenITmng8347TransitiveDependencyManagerTest.class); suite.addTestSuite(MavenITmng8341DeadlockTest.class); diff --git a/core-it-suite/src/test/resources/mng-8340/child1/pom.xml b/core-it-suite/src/test/resources/mng-8340/child1/pom.xml new file mode 100644 index 000000000..be68873dd --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8340/child1/pom.xml @@ -0,0 +1,42 @@ + + + + 4.0.0 + + org.apache.maven.it.mng8340 + root + 1.0.0 + + + child1 + + + + org.slf4j + slf4j-api + 2.0.16 + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.5.0 + + + shade + + shade + + package + + ${basedir}/target/dr-pom.xml + + + + + + + diff --git a/core-it-suite/src/test/resources/mng-8340/child2/pom.xml b/core-it-suite/src/test/resources/mng-8340/child2/pom.xml new file mode 100644 index 000000000..defeefc3c --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8340/child2/pom.xml @@ -0,0 +1,21 @@ + + + + 4.0.0 + + org.apache.maven.it.mng8340 + root + 1.0.0 + + + child2 + + + + org.apache.maven.it.mng8340 + child1 + ${project.version} + + + + diff --git a/core-it-suite/src/test/resources/mng-8340/pom.xml b/core-it-suite/src/test/resources/mng-8340/pom.xml new file mode 100644 index 000000000..2a04859db --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8340/pom.xml @@ -0,0 +1,15 @@ + + + + 4.0.0 + + org.apache.maven.it.mng8340 + root + 1.0.0 + pom + + + child1 + child2 + +