Repository: maven-archetype Updated Branches: refs/heads/master f2f119e17 -> 9e828c304
[ARCHETYPE-519] archetype:generate with specified remote archetypeCatalog falls back to internal catalog throw IllegalArgumentException for all unknown archetypeCatalog values, e.g. file:/ and http:// Project: http://git-wip-us.apache.org/repos/asf/maven-archetype/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-archetype/commit/9e828c30 Tree: http://git-wip-us.apache.org/repos/asf/maven-archetype/tree/9e828c30 Diff: http://git-wip-us.apache.org/repos/asf/maven-archetype/diff/9e828c30 Branch: refs/heads/master Commit: 9e828c30482d0ed38b84f35e86d0eca166f094f6 Parents: f2f119e Author: rfscholte <rfscho...@apache.org> Authored: Wed Feb 15 21:02:55 2017 +0100 Committer: rfscholte <rfscho...@apache.org> Committed: Wed Feb 15 21:02:55 2017 +0100 ---------------------------------------------------------------------- .../src/it/generate-basic/setup.groovy | 24 -------------------- .../mojos/CreateProjectFromArchetypeMojo.java | 19 ++++++++++++++-- .../ui/generation/DefaultArchetypeSelector.java | 11 +++++---- 3 files changed, 24 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/9e828c30/maven-archetype-plugin/src/it/generate-basic/setup.groovy ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/it/generate-basic/setup.groovy b/maven-archetype-plugin/src/it/generate-basic/setup.groovy deleted file mode 100644 index b97616c..0000000 --- a/maven-archetype-plugin/src/it/generate-basic/setup.groovy +++ /dev/null @@ -1,24 +0,0 @@ - -/* - * 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. - */ - -// We can't run "mvn clean" as there is no pom. So we need to remove any already -// created project before executing. -directory = new File(basedir, "project") -directory.deleteDir() http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/9e828c30/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java index f109185..a00911f 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java @@ -95,11 +95,26 @@ public class CreateProjectFromArchetypeMojo * It is a comma separated list of catalogs. * Catalogs use the following schemes: * <ul> - * <li>'<code>local</code>' which is the shortcut for '<code>file://~/.m2/archetype-catalog.xml</code>'</li> - * <li>'<code>remote</code>' which is the shortcut for Maven Central repository, ie '<code>http://repo.maven.apache.org/maven2</code>'</li> + * <li>'<code>local</code>' which is the shortcut to the local repository</li> + * <li>'<code>remote</code>' which is the shortcut for Maven Central repository or its mirror</li> * <li>'<code>internal</code>' which is an internal catalog</li> * </ul> * <p/> + * If you want the catalogs to come from a different repository, please add the following to your + * {@code settings.xml} + * <pre> + * <repository> + * <id>archetype</id> + * <url>https://repository.domain.com/path/to/repo/</url> + * </repository> + * + * <!-- in case of a repository with authentication --> + * <server> + * <id>archetype</id> + * <username>user.name</username> + * <password>s3cr3t</password> + * </server> + * </pre> * If Maven Central repository catalog file is empty, <code>internal</code> catalog is used instead. */ @Parameter( property = "archetypeCatalog", defaultValue = "remote,local" ) http://git-wip-us.apache.org/repos/asf/maven-archetype/blob/9e828c30/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java index 9c0ce4d..0783fb3 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java @@ -100,11 +100,9 @@ public class DefaultArchetypeSelector else { getLogger().warn( - "Archetype not found in any catalog. Falling back to central repository (http://repo.maven.apache.org/maven2)." ); + "Archetype not found in any catalog. Falling back to central repository." ); getLogger().warn( - "Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere." ); - - definition.setRepository( "http://repo.maven.apache.org/maven2" ); + "Add a repsoitory with id 'archetype' in your settings.xml if archetype's repository is elsewhere." ); } } else if ( definition.isPartiallyDefined() ) @@ -208,6 +206,11 @@ public class DefaultArchetypeSelector archetypes.put( "internal", archetypeManager.getInternalCatalog().getArchetypes() ); } } + else + { + throw new IllegalArgumentException( "archetypeCatalog '" + catalog + "' is not supported anymore. " + + "Please read the plugin documentation for details." ); + } } if ( archetypes.size() == 0 )