You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2021/03/12 16:22:26 UTC
[maven-integration-testing] 01/01: [MNG-7110] Different behavior of
extensions
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch MNG-7110
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git
commit 70a45ce2703098c56166bc3ea93548f21d1ec406
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Mar 12 17:21:19 2021 +0100
[MNG-7110] Different behavior of extensions
---
.../org/apache/maven/it/IntegrationTestSuite.java | 1 +
.../it/MavenITmng7110ExtensionClassloader.java | 66 +++++++++++++++++++
.../mng-7110-extensionclassloader/bom/pom.xml | 41 ++++++++++++
.../extension/pom.xml | 31 +++++++++
.../extension/src/main/resources/extension.txt | 16 +++++
.../mng-7110-extensionclassloader/lib/pom.xml | 31 +++++++++
.../lib/src/main/resources/lib.txt | 16 +++++
.../mng-7110-extensionclassloader/module/pom.xml | 74 ++++++++++++++++++++++
.../mng-7110-extensionclassloader/parent/pom.xml | 54 ++++++++++++++++
9 files changed, 330 insertions(+)
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
index 337e1a9..25b9375 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java
@@ -106,6 +106,7 @@ public class IntegrationTestSuite
// Tests that don't run stable and need to be fixed
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
+ suite.addTestSuite( MavenITmng7110ExtensionClassloader.class );
suite.addTestSuite( MavenITmng7051OptionalProfileActivationTest.class );
suite.addTestSuite( MavenITmng6957BuildConsumer.class );
suite.addTestSuite( MavenITmng7045DropUselessAndOutdatedCdiApiTest.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7110ExtensionClassloader.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7110ExtensionClassloader.java
new file mode 100644
index 0000000..dbf313c
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7110ExtensionClassloader.java
@@ -0,0 +1,66 @@
+package org.apache.maven.it;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.Properties;
+
+import org.apache.maven.it.util.ResourceExtractor;
+
+public class MavenITmng7110ExtensionClassloader
+ extends AbstractMavenIntegrationTestCase
+{
+ public MavenITmng7110ExtensionClassloader()
+ {
+ super( ALL_MAVEN_VERSIONS );
+ }
+
+ public void testVerifyResourceOfExtensionAndDependency() throws IOException, VerificationException
+ {
+ final File projectDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7110-extensionclassloader" );
+
+ final Verifier extensionVerifier = newVerifier( new File( projectDir, "extension" ).getAbsolutePath() );
+ extensionVerifier.executeGoal( "install" );
+ extensionVerifier.verifyErrorFreeLog();
+
+ final Verifier libVerifier = newVerifier( new File( projectDir, "lib" ).getAbsolutePath() );
+ libVerifier.executeGoal( "install" );
+ libVerifier.verifyErrorFreeLog();
+
+ final Verifier bomVerifier = newVerifier( new File( projectDir, "bom" ).getAbsolutePath() );
+ bomVerifier.executeGoal( "install" );
+ bomVerifier.verifyErrorFreeLog();
+
+ final Verifier projectVerifier = newVerifier( new File( projectDir, "module" ).getAbsolutePath() );
+ projectVerifier.executeGoal( "verify" );
+ projectVerifier.verifyErrorFreeLog();
+
+ Properties properties = new Properties();
+ Reader fileReader = new FileReader( new File( projectDir, "module/out.txt" ) );
+ properties.load( fileReader );
+
+ assertEquals( "1", properties.getProperty( "extension.txt.count", "-1" ) );
+ assertEquals( "1", properties.getProperty( "lib.txt.count", "-1" ) );
+ }
+
+}
diff --git a/core-it-suite/src/test/resources/mng-7110-extensionclassloader/bom/pom.xml b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/bom/pom.xml
new file mode 100644
index 0000000..96f011a
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/bom/pom.xml
@@ -0,0 +1,41 @@
+<?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>org.apache.maven.its.mng7110</groupId>
+ <artifactId>bom</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng7110</groupId>
+ <artifactId>lib</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7110-extensionclassloader/extension/pom.xml b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/extension/pom.xml
new file mode 100644
index 0000000..c66323b
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/extension/pom.xml
@@ -0,0 +1,31 @@
+<?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>org.apache.maven.its.mng7110</groupId>
+ <artifactId>extension</artifactId>
+ <version>1.0</version>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7110-extensionclassloader/extension/src/main/resources/extension.txt b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/extension/src/main/resources/extension.txt
new file mode 100644
index 0000000..90705e0
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/extension/src/main/resources/extension.txt
@@ -0,0 +1,16 @@
+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.
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-7110-extensionclassloader/lib/pom.xml b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/lib/pom.xml
new file mode 100644
index 0000000..634db8c
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/lib/pom.xml
@@ -0,0 +1,31 @@
+<?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>org.apache.maven.its.mng7110</groupId>
+ <artifactId>lib</artifactId>
+ <version>1.0</version>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7110-extensionclassloader/lib/src/main/resources/lib.txt b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/lib/src/main/resources/lib.txt
new file mode 100644
index 0000000..90705e0
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/lib/src/main/resources/lib.txt
@@ -0,0 +1,16 @@
+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.
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-7110-extensionclassloader/module/pom.xml b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/module/pom.xml
new file mode 100644
index 0000000..6e720e0
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/module/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>
+
+ <parent>
+ <!-- to reproduce the original issue, the parent must NOT be part of the reactor -->
+ <groupId>org.apache.maven.its.mng7110</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ <relativePath>../parent</relativePath>
+ </parent>
+ <artifactId>module</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng7110</groupId>
+ <artifactId>lib</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-class-loader</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>verify</phase>
+ <goals>
+ <goal>load-dependencies</goal>
+ </goals>
+ <configuration>
+ <projectClassLoaderOutput>out.txt</projectClassLoaderOutput>
+ <resourcePaths>lib.txt,extension.txt</resourcePaths>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-class-loader</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/core-it-suite/src/test/resources/mng-7110-extensionclassloader/parent/pom.xml b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/parent/pom.xml
new file mode 100644
index 0000000..c08642c
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7110-extensionclassloader/parent/pom.xml
@@ -0,0 +1,54 @@
+<?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>org.apache.maven.its.mng7110</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mng7110</groupId>
+ <artifactId>bom</artifactId>
+ <version>1.0</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <extensions>
+ <extension>
+ <groupId>org.apache.maven.its.mng7110</groupId>
+ <artifactId>extension</artifactId>
+ <version>1.0</version>
+ </extension>
+ </extensions>
+ </build>
+
+</project>