1 package org.apache.maven.archetype; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import org.apache.maven.archetype.catalog.Archetype; 23 import org.apache.maven.archetype.catalog.ArchetypeCatalog; 24 import org.apache.maven.artifact.DependencyResolutionRequiredException; 25 26 import java.io.File; 27 import java.io.IOException; 28 29 /** @author Jason van Zyl */ 30 public interface ArchetypeManager 31 { 32 String ROLE = ArchetypeManager.class.getName(); 33 34 /** 35 * A command to create an archetype from an existing Maven project given the supplied 36 * creation request. 37 * 38 * @param request 39 * @return The result of creating the archetype from the existing project. It contains any errors that might have occurred. 40 */ 41 ArchetypeCreationResult createArchetypeFromProject( ArchetypeCreationRequest request ); 42 43 /** 44 * A command to generate a Maven project from an archetype given the supplied 45 * generation request. 46 * 47 * @param request 48 * @return The result of creating the project from the existing archetype. It contains any errors that might have occurred. 49 */ 50 ArchetypeGenerationResult generateProjectFromArchetype( ArchetypeGenerationRequest request ); 51 52 /** 53 * Gives the catalog of archetypes internal to the plugin. 54 * @return the catalog. 55 */ 56 ArchetypeCatalog getInternalCatalog(); 57 58 /** 59 * Gives the catalog of archetypes located in <code>${user.home}/.m2/repository/archetype-catalog.xml</code>. 60 * @return the catalog. 61 */ 62 ArchetypeCatalog getDefaultLocalCatalog(); 63 64 /** 65 * Gives the catalog of archetypes located in the given path. 66 * if path is a file, it used as is. 67 * if path is a directory, archetype-catalog.xml is appended to it. 68 * @param path the catalog file path or directory containing the catalog file. 69 * @return the catalog. 70 */ 71 ArchetypeCatalog getLocalCatalog( String path ); 72 73 /** 74 * Gives the catalog of archetypes located at <code>http://repo1.maven.org/maven2/archetype-catalog.xml</code>. 75 * @return the catalog. 76 */ 77 ArchetypeCatalog getRemoteCatalog(); 78 79 /** 80 * Gives the catalog of archetypes located at the given url. 81 * if the url doesn't define a catalog, then <code>'archetype-catalog.xml'</code> is appended to it for search. 82 * @param url the catalog url or base url containing the catalog file. 83 * @return the catalog. 84 */ 85 ArchetypeCatalog getRemoteCatalog( String url ); 86 87 /** 88 * Creates a jar file for an archetype. 89 * 90 * @param archetypeDirectory 91 * @param outputDirectory 92 * @param finalName 93 * @return The File to the generated jar 94 * @throws org.apache.maven.artifact.DependencyResolutionRequiredException 95 * 96 * @throws java.io.IOException 97 */ 98 File archiveArchetype( File archetypeDirectory, File outputDirectory, String finalName ) 99 throws DependencyResolutionRequiredException, IOException; 100 101 void updateLocalCatalog( Archetype archetype, String path ); 102 103 void updateLocalCatalog( Archetype archetype ); 104 }