Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-8340] IT #400

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* 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 java.util.List;

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-8340">MNG-8340</a>.
*/
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();

List<String> l = verifier.loadLines(verifier.getLogFileName(), "UTF-8");
if (matchesVersionRange("[4.0.0-beta-5]")) {
assertTrue(l.stream()
.anyMatch(i -> i.contains(
"[FATAL] 'parent.relativePath' points at '../../pom.xml' but no POM could be found")));
} else {
assertFalse(l.stream()
.anyMatch(i -> i.contains(
"[FATAL] 'parent.relativePath' points at '../../pom.xml' but no POM could be found")));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
42 changes: 42 additions & 0 deletions core-it-suite/src/test/resources/mng-8340/child1/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.it.mng8340</groupId>
<artifactId>root</artifactId>
<version>1.0.0</version>
</parent>

<artifactId>child1</artifactId>

<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.16</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<id>shade</id>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
<configuration>
<dependencyReducedPomLocation>${basedir}/target/dr-pom.xml</dependencyReducedPomLocation>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
21 changes: 21 additions & 0 deletions core-it-suite/src/test/resources/mng-8340/child2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.maven.it.mng8340</groupId>
<artifactId>root</artifactId>
<version>1.0.0</version>
</parent>

<artifactId>child2</artifactId>

<dependencies>
<dependency>
<groupId>org.apache.maven.it.mng8340</groupId>
<artifactId>child1</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

</project>
15 changes: 15 additions & 0 deletions core-it-suite/src/test/resources/mng-8340/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>org.apache.maven.it.mng8340</groupId>
<artifactId>root</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>

<modules>
<module>child1</module>
<module>child2</module>
</modules>
</project>
Loading