You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2021/12/10 14:41:57 UTC

[maven-archetype] branch ARCHETYPE-622 created (now 18f57d7)

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

slachiewicz pushed a change to branch ARCHETYPE-622
in repository https://gitbox.apache.org/repos/asf/maven-archetype.git.


      at 18f57d7  [ARCHETYPE-622] maven-archetype-plugin integration-test doesn't use Maven settings from the main build""

This branch includes the following new commits:

     new 18f57d7  [ARCHETYPE-622] maven-archetype-plugin integration-test doesn't use Maven settings from the main build""

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[maven-archetype] 01/01: [ARCHETYPE-622] maven-archetype-plugin integration-test doesn't use Maven settings from the main build""

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch ARCHETYPE-622
in repository https://gitbox.apache.org/repos/asf/maven-archetype.git

commit 18f57d71d3a8e3f88224c1d16a93830688f3c96a
Author: Marián Macik <mm...@redhat.com>
AuthorDate: Mon Nov 22 20:55:14 2021 +0100

    [ARCHETYPE-622] maven-archetype-plugin integration-test doesn't use Maven settings from the main build""
---
 .../invoker.properties                             | 19 ++++++
 .../ARCHETYPE-622_main_build_settings/pom.xml      | 73 ++++++++++++++++++++++
 .../META-INF/maven/archetype-metadata.xml          | 34 ++++++++++
 .../src/main/resources/archetype-resources/pom.xml | 50 +++++++++++++++
 .../archetype-resources/src/main/java/App.java     | 36 +++++++++++
 .../resources/projects/basic/archetype.properties  | 21 +++++++
 .../src/test/resources/projects/basic/goal.txt     |  1 +
 .../resources/projects/basic/reference/pom.xml     | 49 +++++++++++++++
 .../src/main/java/build/archetype/App.java         | 36 +++++++++++
 .../test/resources/projects/basic/verify.groovy    | 21 +++++++
 .../test-settings.xml                              | 55 ++++++++++++++++
 .../ARCHETYPE-622_main_build_settings/verify.bsh   | 63 +++++++++++++++++++
 .../maven/archetype/mojos/IntegrationTestMojo.java | 27 +++++++-
 13 files changed, 483 insertions(+), 2 deletions(-)

diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/invoker.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/invoker.properties
new file mode 100644
index 0000000..a4dc5ae
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/invoker.properties
@@ -0,0 +1,19 @@
+# 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.
+
+invoker.goals = clean integration-test
+invoker.settingsFile = ${basedir}/target/it/projects/ARCHETYPE-622_main_build_settings/test-settings.xml
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/pom.xml
new file mode 100644
index 0000000..cb486ca
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/pom.xml
@@ -0,0 +1,73 @@
+<?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.plugins.archetype.its</groupId>
+  <artifactId>build-archetype-and-run-its-with-main-build-settings</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>maven-archetype</packaging>
+
+  <name>build-archetype-with-existing-parent</name>
+  <description>packages an archetype then runs IT (archetype:integration-test) within a Maven Project being created through another archetype</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <extensions>
+      <extension>
+        <groupId>org.apache.maven.archetype</groupId>
+        <artifactId>archetype-packaging</artifactId>
+        <version>@project.version@</version>
+      </extension>
+    </extensions>
+
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-archetype-plugin</artifactId>
+          <version>@project.version@</version>
+          <configuration>
+            <debug>true</debug>
+            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+            <ignoreEOLStyle>true</ignoreEOLStyle>
+            <properties>
+              <maven.compiler.source>${maven.compiler.source}</maven.compiler.source>
+              <maven.compiler.target>${maven.compiler.target}</maven.compiler.target>
+              <!-- e.g. ensure that Java7 picks up TLSv1.2 when connecting with Central -->
+              <https.protocols>${https.protocols}</https.protocols>
+            </properties>
+          </configuration>
+        </plugin>
+        <plugin>
+          <artifactId>maven-resources-plugin</artifactId>
+          <configuration>
+            <includeEmptyDirs>true</includeEmptyDirs>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/main/resources/META-INF/maven/archetype-metadata.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/main/resources/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..28ff4bf
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,34 @@
+<?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.
+-->
+
+<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
+    name="build-archetype-IT">
+  <fileSets>
+    <fileSet filtered="true" packaged="true" encoding="UTF-8">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/main/resources/archetype-resources/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/main/resources/archetype-resources/pom.xml
new file mode 100644
index 0000000..aa77176
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/main/resources/archetype-resources/pom.xml
@@ -0,0 +1,50 @@
+<?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>
+## There should be no parent specified, as it should be set automatically
+
+  <groupId>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+
+  <name>archetype build IT</name>
+
+  <properties>
+    <javaVersion>6</javaVersion>
+    <maven.compiler.source>1.${javaVersion}</maven.compiler.source>
+    <maven.compiler.target>1.${javaVersion}</maven.compiler.target>    
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.7.0</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/main/resources/archetype-resources/src/main/java/App.java b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/main/resources/archetype-resources/src/main/java/App.java
new file mode 100644
index 0000000..eb9b6c7
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/main/resources/archetype-resources/src/main/java/App.java
@@ -0,0 +1,36 @@
+package ${package};
+
+/*
+ * 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.
+ */
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+        System.out.println( "groupId = ${groupId}" );
+        System.out.println( "artifactId = ${artifactId}" );
+        System.out.println( "package = ${package}" );
+        System.out.println( "packageInPathFormat = ${packageInPathFormat}" );
+    }
+}
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/archetype.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/archetype.properties
new file mode 100644
index 0000000..3560bb4
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/archetype.properties
@@ -0,0 +1,21 @@
+# 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.
+
+version=0.1-SNAPSHOT
+groupId=archetype.it
+artifactId=basic
+package=build.archetype
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/goal.txt b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/goal.txt
new file mode 100644
index 0000000..f8808ba
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/goal.txt
@@ -0,0 +1 @@
+compile
\ No newline at end of file
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/reference/pom.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/reference/pom.xml
new file mode 100644
index 0000000..42e28ce
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/reference/pom.xml
@@ -0,0 +1,49 @@
+<?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>archetype.it</groupId>
+  <artifactId>basic</artifactId>
+  <version>0.1-SNAPSHOT</version>
+
+  <name>archetype build IT</name>
+
+  <properties>
+    <javaVersion>6</javaVersion>
+    <maven.compiler.source>1.${javaVersion}</maven.compiler.source>
+    <maven.compiler.target>1.${javaVersion}</maven.compiler.target>    
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.7.0</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/reference/src/main/java/build/archetype/App.java b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/reference/src/main/java/build/archetype/App.java
new file mode 100644
index 0000000..d507638
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/reference/src/main/java/build/archetype/App.java
@@ -0,0 +1,36 @@
+package build.archetype;
+
+/*
+ * 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.
+ */
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+        System.out.println( "groupId = archetype.it" );
+        System.out.println( "artifactId = basic" );
+        System.out.println( "package = build.archetype" );
+        System.out.println( "packageInPathFormat = build/archetype" );
+    }
+}
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/verify.groovy b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/verify.groovy
new file mode 100644
index 0000000..3bfdaa4
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/src/test/resources/projects/basic/verify.groovy
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+println( 'Archetype tests executed!' )
+System.out.flush()
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/test-settings.xml b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/test-settings.xml
new file mode 100644
index 0000000..ab9e16e
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/test-settings.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.
+-->
+
+<settings>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <repositories>
+        <repository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+</settings>
\ No newline at end of file
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/verify.bsh b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/verify.bsh
new file mode 100644
index 0000000..0e98609
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-622_main_build_settings/verify.bsh
@@ -0,0 +1,63 @@
+
+/*
+ * 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.*;
+import org.codehaus.plexus.util.*;
+
+basedir = new File( basedir, "target/test-classes/projects/basic/project/basic" );
+if ( !basedir.exists() ) {
+	throw new Exception( basedir + " is missing." );
+}
+
+File main = new File( basedir, "src/main" );
+
+// check <fileset packaged="true">
+File app = new File( main, "java/build/archetype/App.java" );
+if ( !app.isFile() )
+{
+    throw new Exception( app + " file is missing or not a file." );
+}
+
+File buildLog = new File( basedir, "build.log" );
+
+String content = FileUtils.fileRead( buildLog, "UTF-8" );
+
+int idx = content.indexOf( "Archetype tests executed!" );
+if ( idx < 0 )
+{
+    throw new Exception( "build.log missing System.out.println from verify.groovy" );
+}
+
+// we expect the archetype:integration-test to use the settings.xml from the main Maven build - so downloading should happen
+// also from local.central specified in the test-settings.xml
+int idx = content.indexOf( "Downloading from local.central: file://" );
+if ( idx <0 )
+{
+    throw new Exception( "test-settings.xml wasn't passed from the main Maven build!: 'Downloading from local.central: file://' was NOT found in the output!" );
+}
+
+String settingsXmlPath = new File("maven-archetype/maven-archetype-plugin/target/it/projects/ARCHETYPE-622_main_build_settings/target/classes/archetype-it", "archetype-settings.xml").toPath().toString();
+settingsXmlPath = settingsXmlPath.replace("\\", "\\\\"); // Windows path handling
+
+boolean usingSettingsFromMainBuild = content.matches("(?s).*\\[DEBUG\\] Reading user settings from .*" + settingsXmlPath + ".*");
+if ( !usingSettingsFromMainBuild )
+{
+    throw new Exception( "test-settings.xml wasn't passed from the main Maven build!: 'Reading user settings from ... archetype-settings.xml' was NOT found in the output!" + content );
+}
diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
index f44375a..c0f42b5 100644
--- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
+++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java
@@ -23,6 +23,7 @@ import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
@@ -56,6 +57,7 @@ import org.apache.maven.project.DefaultProjectBuildingRequest;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.ProjectBuildingRequest;
 import org.apache.maven.settings.Settings;
+import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
 import org.apache.maven.shared.transfer.artifact.DefaultArtifactCoordinate;
 import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver;
 import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException;
@@ -662,7 +664,6 @@ public class IntegrationTestMojo
                 request.setProperties( props );
             }
 
-            File interpolatedSettingsFile = null;
             if ( settingsFile != null )
             {
                 File interpolatedSettingsDirectory =
@@ -672,13 +673,35 @@ public class IntegrationTestMojo
                     FileUtils.deleteDirectory( interpolatedSettingsDirectory );
                 }
                 interpolatedSettingsDirectory.mkdir();
-                interpolatedSettingsFile =
+                File interpolatedSettingsFile =
                     new File( interpolatedSettingsDirectory, "interpolated-" + settingsFile.getName() );
 
                 buildInterpolatedFile( settingsFile, interpolatedSettingsFile );
 
                 request.setUserSettingsFile( interpolatedSettingsFile );
             }
+            else // Use settings coming from the main Maven build
+            {
+                File mainBuildSettingsDirectory =
+                        new File( project.getBuild().getOutputDirectory(), "archetype-it" );
+                mainBuildSettingsDirectory.mkdir();
+                File mainBuildSettingsFile = new File( mainBuildSettingsDirectory, "archetype-settings.xml" );
+
+                SettingsXpp3Writer settingsWriter = new SettingsXpp3Writer();
+
+                try ( FileWriter fileWriter = new FileWriter( mainBuildSettingsFile ) )
+                {
+                    settingsWriter.write( fileWriter, settings );
+                }
+
+                if ( getLog().isDebugEnabled() )
+                {
+                    getLog().debug( "Created archetype-settings.xml with settings from the main Maven build: "
+                                            + mainBuildSettingsFile.getAbsolutePath() );
+                }
+
+                request.setUserSettingsFile( mainBuildSettingsFile );
+            }
 
             try
             {