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 import org.apache.maven.project.ProjectBuildingRequest; 26 27 import java.io.File; 28 import java.io.IOException; 29 30 /** @author Jason van Zyl */ 31 public interface ArchetypeManager 32 { 33 String ROLE = ArchetypeManager.class.getName(); 34 35 /** 36 * A command to create an archetype from an existing Maven project given the supplied 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 40 * occurred. 41 */ 42 ArchetypeCreationResult createArchetypeFromProject( ArchetypeCreationRequest request ); 43 44 /** 45 * A command to generate a Maven project from an archetype given the supplied 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 49 * occurred. 50 */ 51 ArchetypeGenerationResult generateProjectFromArchetype( ArchetypeGenerationRequest request ); 52 53 /** 54 * Gives the catalog of archetypes internal to the plugin. 55 * 56 * @return the catalog. 57 */ 58 ArchetypeCatalog getInternalCatalog(); 59 60 /** 61 * Gives the catalog of archetypes located in the given path. 62 * if path is a file, it used as is. 63 * if path is a directory, archetype-catalog.xml is appended to it. 64 * 65 * @param buildingRequest the catalog file path or directory containing the catalog file. 66 * @return the catalog. 67 */ 68 ArchetypeCatalog getLocalCatalog( ProjectBuildingRequest buildingRequest ); 69 70 /** 71 * Gives the catalog of archetypes located at 72 * <code>https://repo.maven.apache.org/maven2/archetype-catalog.xml</code>. 73 * @param buildingRequest TODO 74 * 75 * @return the catalog. 76 */ 77 ArchetypeCatalog getRemoteCatalog( ProjectBuildingRequest buildingRequest ); 78 79 /** 80 * Creates a jar file for an archetype. 81 * 82 * @param archetypeDirectory 83 * @param outputDirectory 84 * @param finalName 85 * @return The File to the generated jar 86 * @throws org.apache.maven.artifact.DependencyResolutionRequiredException 87 * @throws java.io.IOException 88 * @deprecated replaced by archetype plugin's JarMojo using maven-archiver component for Reproducible Builds 89 */ 90 @Deprecated 91 File archiveArchetype( File archetypeDirectory, File outputDirectory, String finalName ) 92 throws DependencyResolutionRequiredException, IOException; 93 94 void updateLocalCatalog( ProjectBuildingRequest buildingRequest, Archetype archetype ); 95 }