This is an automated email from the ASF dual-hosted git repository. cstamas pushed a commit to branch maven-3.9.x in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
The following commit(s) were added to refs/heads/maven-3.9.x by this push: new cb9d2c970 [3.9.x] [MNG-8106] IT (#337) cb9d2c970 is described below commit cb9d2c97076222604b22bdba99d2bcc4907c1c96 Author: Tamas Cservenak <ta...@cservenak.net> AuthorDate: Thu Apr 25 12:01:06 2024 +0200 [3.9.x] [MNG-8106] IT (#337) Created IT that does "wrong" (as same directory has once G and once A role), and verify that both level metadata is present. In other words, but none is dropped. --- https://issues.apache.org/jira/browse/MNG-8106 --- ...avenITmng8106OverlappingDirectoryRolesTest.java | 58 +++++++++++++++++ .../org/apache/maven/it/TestSuiteOrdering.java | 1 + .../src/test/resources/mng-8106/jar/.mvn/.gitkeep | 0 .../src/test/resources/mng-8106/jar/pom.xml | 47 ++++++++++++++ .../test/resources/mng-8106/plugin/.mvn/.gitkeep | 0 .../src/test/resources/mng-8106/plugin/pom.xml | 74 ++++++++++++++++++++++ .../org/apache/maven/its/plugins/MavenPlugin.java | 35 ++++++++++ 7 files changed, 215 insertions(+) diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8106OverlappingDirectoryRolesTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8106OverlappingDirectoryRolesTest.java new file mode 100644 index 000000000..80e38b072 --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng8106OverlappingDirectoryRolesTest.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 java.io.FileReader; + +import org.apache.maven.shared.verifier.Verifier; +import org.apache.maven.shared.verifier.util.ResourceExtractor; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomBuilder; +import org.junit.jupiter.api.Test; + +public class MavenITmng8106OverlappingDirectoryRolesTest extends AbstractMavenIntegrationTestCase { + public MavenITmng8106OverlappingDirectoryRolesTest() { + // Broken in: 3.9.0..3.9.6 && 4.0.0-alpha-1..4.0.0-alpha-13 + super("[,3.9.0),(3.9.6,3.999.999],[4.0.0-beta-1,)"); + } + + @Test + public void testDirectoryOverlap() throws Exception { + File testDir = ResourceExtractor.simpleExtractResources(getClass(), "/mng-8106"); + + Verifier verifier = newVerifier(new File(testDir, "plugin").getAbsolutePath()); + verifier.addCliArgument("install"); + verifier.execute(); + verifier.verifyErrorFreeLog(); + + verifier = newVerifier(new File(testDir, "jar").getAbsolutePath()); + verifier.addCliArgument("install"); + verifier.execute(); + verifier.verifyErrorFreeLog(); + + File metadataFile = new File(new File(verifier.getLocalRepository()), "mng-8106/it/maven-metadata-local.xml"); + Xpp3Dom dom; + try (FileReader reader = new FileReader(metadataFile)) { + dom = Xpp3DomBuilder.build(reader); + } + assertTrue("metadata missing A level data", dom.getChild("versioning") != null); + assertTrue("metadata missing G level data", dom.getChild("plugins") != null); + } +} 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 159406bdd..0cd88ba47 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(MavenITmng8106OverlappingDirectoryRolesTest.class); suite.addTestSuite(MavenITmng7939PluginsValidationExcludesTest.class); suite.addTestSuite(MavenITmng7804PluginExecutionOrderTest.class); suite.addTestSuite(MavenITmng7836AlternativePomSyntaxTest.class); diff --git a/core-it-suite/src/test/resources/mng-8106/jar/.mvn/.gitkeep b/core-it-suite/src/test/resources/mng-8106/jar/.mvn/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/core-it-suite/src/test/resources/mng-8106/jar/pom.xml b/core-it-suite/src/test/resources/mng-8106/jar/pom.xml new file mode 100644 index 000000000..a8d93c46c --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8106/jar/pom.xml @@ -0,0 +1,47 @@ +<?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 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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>mng-8106</groupId> + <artifactId>it</artifactId> + <version>0.1</version> + <packaging>jar</packaging> + + <properties> + <maven-version>3.8.6</maven-version> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-model</artifactId> + <version>${maven-version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>${maven-version}</version> + <scope>provided</scope> + </dependency> + </dependencies> + +</project> diff --git a/core-it-suite/src/test/resources/mng-8106/plugin/.mvn/.gitkeep b/core-it-suite/src/test/resources/mng-8106/plugin/.mvn/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/core-it-suite/src/test/resources/mng-8106/plugin/pom.xml b/core-it-suite/src/test/resources/mng-8106/plugin/pom.xml new file mode 100644 index 000000000..b7d27b7c3 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8106/plugin/pom.xml @@ -0,0 +1,74 @@ +<?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 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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>mng-8106.it</groupId> + <artifactId>plugin</artifactId> + <version>0.1</version> + <packaging>maven-plugin</packaging> + + <properties> + <mavenVersion>3.8.6</mavenVersion> + <mavenPluginPluginVersion>3.2</mavenPluginPluginVersion> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>${mavenVersion}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-model</artifactId> + <version>${mavenVersion}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>${mavenVersion}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <version>${mavenPluginPluginVersion}</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + <configuration> + <goalPrefix>plugin</goalPrefix> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + +</project> diff --git a/core-it-suite/src/test/resources/mng-8106/plugin/src/main/java/org/apache/maven/its/plugins/MavenPlugin.java b/core-it-suite/src/test/resources/mng-8106/plugin/src/main/java/org/apache/maven/its/plugins/MavenPlugin.java new file mode 100644 index 000000000..2e4f074cc --- /dev/null +++ b/core-it-suite/src/test/resources/mng-8106/plugin/src/main/java/org/apache/maven/its/plugins/MavenPlugin.java @@ -0,0 +1,35 @@ +/* + * 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.plugins; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Mojo; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Mojo(name = "plugin") +public class MavenPlugin extends AbstractMojo { + + private static final Logger log = LoggerFactory.getLogger(MavenPlugin.class); + + public void execute() throws MojoExecutionException { + log.info("Booo"); + } +}