[ARCHETYPE-521] Cannot specify remote repository for generate project from archetype

Verified with integration-test
diff --git a/maven-archetype-plugin/pom.xml b/maven-archetype-plugin/pom.xml
index ba6b272..3fc6765 100644
--- a/maven-archetype-plugin/pom.xml
+++ b/maven-archetype-plugin/pom.xml
@@ -181,21 +181,38 @@
             <version>1.1.0</version>
             <executions>
               <execution>
+                <id>mirror</id>
                 <goals>
                   <goal>start</goal>
                   <goal>stop</goal>
                 </goals>
+                <configuration>
+                  <repositories>
+                    <mockRepo>
+                      <source>src/it/mrm/repository</source>
+                      <cloneTo>target/mock-repo</cloneTo>
+                    </mockRepo>
+                    <proxyRepo/>
+                  </repositories>
+                </configuration>
+              </execution>
+              <execution>
+                <id>archetype-repository</id>
+                <goals>
+                  <goal>start</goal>
+                  <goal>stop</goal>
+                </goals>
+                <configuration>
+                  <propertyName>archetype-repo.proxy.url</propertyName>
+                  <repositories>
+                    <mockRepo>
+                      <source>src/it/mrm/archetype-repository</source>
+                      <cloneTo>target/archetype-repo</cloneTo>
+                    </mockRepo>
+                  </repositories>
+                </configuration>
               </execution>
             </executions>
-            <configuration>
-              <repositories>
-                <mockRepo>
-                  <source>src/it/mrm/repository</source>
-                  <cloneTo>target/mock-repo</cloneTo>
-                </mockRepo>
-                <proxyRepo/>
-              </repositories>
-            </configuration>
           </plugin>
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
@@ -213,6 +230,7 @@
               <settingsFile>src/it/mrm/settings.xml</settingsFile>
               <filterProperties>
                 <repository.proxy.url>${mrm.repository.url}</repository.proxy.url>
+                <archetype-repo.proxy.url>${archetype-repo.proxy.url}</archetype-repo.proxy.url>
               </filterProperties>
             </configuration>
             <executions>
diff --git a/maven-archetype-plugin/src/it/mrm/archetype-repository/3rdparty-archetype-1.0.jar/META-INF/maven/archetype-metadata.xml b/maven-archetype-plugin/src/it/mrm/archetype-repository/3rdparty-archetype-1.0.jar/META-INF/maven/archetype-metadata.xml
new file mode 100644
index 0000000..d504e4e
--- /dev/null
+++ b/maven-archetype-plugin/src/it/mrm/archetype-repository/3rdparty-archetype-1.0.jar/META-INF/maven/archetype-metadata.xml
@@ -0,0 +1,30 @@
+<?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 name="custom">
+  <fileSets>
+    <fileSet filtered="true" packaged="true">
+      <directory>src/main/java</directory>
+      <includes>
+        <include>**/*.java</include>
+      </includes>
+    </fileSet>
+  </fileSets>
+</archetype-descriptor>
\ No newline at end of file
diff --git a/maven-archetype-plugin/src/it/mrm/archetype-repository/3rdparty-archetype-1.0.jar/archetype-resources/pom.xml b/maven-archetype-plugin/src/it/mrm/archetype-repository/3rdparty-archetype-1.0.jar/archetype-resources/pom.xml
new file mode 100644
index 0000000..9cde305
--- /dev/null
+++ b/maven-archetype-plugin/src/it/mrm/archetype-repository/3rdparty-archetype-1.0.jar/archetype-resources/pom.xml
@@ -0,0 +1,31 @@
+<!--
+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>${groupId}</groupId>
+  <artifactId>${artifactId}</artifactId>
+  <version>${version}</version>
+
+  <description>Generated with org.apache.maven.archetypes.its:3rdparty-archetype:1.0</description>
+  
+</project>
diff --git a/maven-archetype-plugin/src/it/mrm/archetype-repository/3rdparty-archetype-1.0.pom b/maven-archetype-plugin/src/it/mrm/archetype-repository/3rdparty-archetype-1.0.pom
new file mode 100644
index 0000000..a248099
--- /dev/null
+++ b/maven-archetype-plugin/src/it/mrm/archetype-repository/3rdparty-archetype-1.0.pom
@@ -0,0 +1,29 @@
+<!--
+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.archetypes.its</groupId>
+  <artifactId>3rdparty-archetype</artifactId>
+  <version>1.0</version>
+
+</project>
diff --git a/maven-archetype-plugin/src/it/mrm/archetype-repository/archetype-catalog.xml b/maven-archetype-plugin/src/it/mrm/archetype-repository/archetype-catalog.xml
new file mode 100644
index 0000000..02ad075
--- /dev/null
+++ b/maven-archetype-plugin/src/it/mrm/archetype-repository/archetype-catalog.xml
@@ -0,0 +1,35 @@
+<?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-catalog
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd"
+  xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    
+  <archetypes>
+    <archetype>
+      <groupId>org.apache.maven.archetypes.its</groupId>
+      <artifactId>3rdparty-archetype</artifactId>
+      <version>1.0</version>
+      <description>A custom archetype only available or ITs</description>
+    </archetype>
+  </archetypes>
+
+</archetype-catalog>
\ No newline at end of file
diff --git a/maven-archetype-plugin/src/it/mrm/settings.xml b/maven-archetype-plugin/src/it/mrm/settings.xml
index 9c21101..5913350 100644
--- a/maven-archetype-plugin/src/it/mrm/settings.xml
+++ b/maven-archetype-plugin/src/it/mrm/settings.xml
@@ -25,7 +25,7 @@
       <id>mrm-maven-plugin</id>
       <name>Mock Repository Manager</name>
       <url>@repository.proxy.url@</url>
-      <mirrorOf>*</mirrorOf>
+      <mirrorOf>*,!archetype</mirrorOf>
     </mirror>
   </mirrors>
   <profiles>
@@ -67,5 +67,25 @@
         </pluginRepository>
       </pluginRepositories>
     </profile>
+    
+    <profile>
+      <id>acme</id>
+      <repositories>
+        <repository>
+          <id>archetype</id>
+          <url>@archetype-repo.proxy.url@</url>
+          <releases>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>never</updatePolicy>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+            <checksumPolicy>ignore</checksumPolicy>
+            <updatePolicy>always</updatePolicy>
+          </snapshots>
+        </repository>
+      </repositories>
+    </profile>
   </profiles>
 </settings>
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-521_archetype-repo/invoker.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-521_archetype-repo/invoker.properties
new file mode 100644
index 0000000..febc96a
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-521_archetype-repo/invoker.properties
@@ -0,0 +1,18 @@
+# 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 = org.apache.maven.plugins:maven-archetype-plugin:${project.version}:generate -Pacme
\ No newline at end of file
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-521_archetype-repo/test.properties b/maven-archetype-plugin/src/it/projects/ARCHETYPE-521_archetype-repo/test.properties
new file mode 100644
index 0000000..010419d
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-521_archetype-repo/test.properties
@@ -0,0 +1,25 @@
+# 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.
+
+archetypeGroupId=org.apache.maven.archetypes.its
+archetypeArtifactId=3rdparty-archetype
+archetypeVersion=1.0
+
+groupId=com.company
+artifactId=project
+version=1.0-SNAPSHOT
+package=com.company.project
\ No newline at end of file
diff --git a/maven-archetype-plugin/src/it/projects/ARCHETYPE-521_archetype-repo/verify.groovy b/maven-archetype-plugin/src/it/projects/ARCHETYPE-521_archetype-repo/verify.groovy
new file mode 100644
index 0000000..d2bffac
--- /dev/null
+++ b/maven-archetype-plugin/src/it/projects/ARCHETYPE-521_archetype-repo/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.
+ */
+
+def project = new XmlSlurper().parse( new File( basedir, "project/pom.xml" ) )
+assert project.description.text()  == 'Generated with org.apache.maven.archetypes.its:3rdparty-archetype:1.0'
\ No newline at end of file