You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/02/19 20:04:23 UTC

[maven-integration-testing] 01/01: [MNG-7395] Support interpolation in extensions.xml

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

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

commit f26315a3809d01a229db5fe437bb7dd07c899c35
Author: Christoph Läubrich <ch...@laeubi-soft.de>
AuthorDate: Wed Feb 9 10:53:31 2022 +0100

    [MNG-7395] Support interpolation in extensions.xml
    
    This closes #136
---
 .../maven/it/MavenITmng5771CoreExtensionsTest.java | 48 +++++++++++++++++++
 .../client-config/.mvn/extensions.xml              | 28 +++++++++++
 .../client-config/.mvn/maven.config                |  1 +
 .../mng-5771-core-extensions/client-config/pom.xml | 55 ++++++++++++++++++++++
 .../client-properties/.mvn/extensions.xml          | 28 +++++++++++
 .../client-properties/pom.xml                      | 55 ++++++++++++++++++++++
 6 files changed, 215 insertions(+)

diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java
index 94c6994..933ee90 100644
--- a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5771CoreExtensionsTest.java
@@ -98,4 +98,52 @@ public class MavenITmng5771CoreExtensionsTest
 
         server.stop();
     }
+
+    //
+    // https://issues.apache.org/jira/browse/MNG-7395: Support properties in extensions.xml
+    //
+    public void testCoreExtensionWithProperties()
+        throws Exception
+    {
+        requiresMavenVersion( "[3.8.5,)" );
+
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5771-core-extensions" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
+
+        verifier = newVerifier( new File( testDir, "client-properties" ).getAbsolutePath() );
+        verifier.deleteDirectory( "target" );
+        verifier.deleteArtifacts( "org.apache.maven.its.it-core-extensions" );
+        verifier.getCliOptions().add( "-s" );
+        verifier.getCliOptions().add( new File( testDir, "settings.xml" ).getAbsolutePath() );
+        verifier.getCliOptions().add( "-Dtest-extension-version=0.1" );
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+    }
+
+    //
+    // https://issues.apache.org/jira/browse/MNG-7395: Support properties in extensions.xml
+    //
+    public void testCoreExtensionWithConfig()
+        throws Exception
+    {
+        requiresMavenVersion( "[3.8.5,)" );
+
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5771-core-extensions" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
+
+        verifier = newVerifier( new File( testDir, "client-config" ).getAbsolutePath() );
+        verifier.deleteDirectory( "target" );
+        verifier.deleteArtifacts( "org.apache.maven.its.it-core-extensions" );
+        verifier.getCliOptions().add( "-s" );
+        verifier.getCliOptions().add( new File( testDir, "settings.xml" ).getAbsolutePath() );
+        verifier.setForkJvm( true ); // force forked JVM since we need the shell script to detect .mvn/
+        verifier.executeGoal( "validate" );
+        verifier.verifyErrorFreeLog();
+        verifier.resetStreams();
+    }
 }
diff --git a/core-it-suite/src/test/resources/mng-5771-core-extensions/client-config/.mvn/extensions.xml b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-config/.mvn/extensions.xml
new file mode 100644
index 0000000..4a703c1
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-config/.mvn/extensions.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<extensions>
+  <extension>
+    <groupId>org.apache.maven.its.it-core-extensions</groupId>
+    <artifactId>maven-it-core-extensions</artifactId>
+    <version>${test-extension-version}</version>
+  </extension>
+</extensions>
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-5771-core-extensions/client-config/.mvn/maven.config b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-config/.mvn/maven.config
new file mode 100644
index 0000000..d4f5388
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-config/.mvn/maven.config
@@ -0,0 +1 @@
+-Dtest-extension-version=0.1
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-5771-core-extensions/client-config/pom.xml b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-config/pom.xml
new file mode 100644
index 0000000..fa398ca
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-config/pom.xml
@@ -0,0 +1,55 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.it-core-extensions</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: it-core-extensions</name>
+  <description>
+    Verify that Maven loads core extensions and components contributed by the extensions are available to regular
+    plugins.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.it-core-extensions</groupId>
+        <artifactId>maven-it-plugin-core-extensions-client</artifactId>
+        <version>0.1</version>
+        <executions>
+          <execution>
+            <id>validate-extensions</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>validate-component</goal>
+              <goal>validate-classpath</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/core-it-suite/src/test/resources/mng-5771-core-extensions/client-properties/.mvn/extensions.xml b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-properties/.mvn/extensions.xml
new file mode 100644
index 0000000..4a703c1
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-properties/.mvn/extensions.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<extensions>
+  <extension>
+    <groupId>org.apache.maven.its.it-core-extensions</groupId>
+    <artifactId>maven-it-core-extensions</artifactId>
+    <version>${test-extension-version}</version>
+  </extension>
+</extensions>
\ No newline at end of file
diff --git a/core-it-suite/src/test/resources/mng-5771-core-extensions/client-properties/pom.xml b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-properties/pom.xml
new file mode 100644
index 0000000..fa398ca
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-5771-core-extensions/client-properties/pom.xml
@@ -0,0 +1,55 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.it-core-extensions</groupId>
+  <artifactId>test</artifactId>
+  <version>0.1</version>
+  <packaging>jar</packaging>
+
+  <name>Maven Integration Test :: it-core-extensions</name>
+  <description>
+    Verify that Maven loads core extensions and components contributed by the extensions are available to regular
+    plugins.
+  </description>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.its.it-core-extensions</groupId>
+        <artifactId>maven-it-plugin-core-extensions-client</artifactId>
+        <version>0.1</version>
+        <executions>
+          <execution>
+            <id>validate-extensions</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>validate-component</goal>
+              <goal>validate-classpath</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>