View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.archetype;
20  
21  import java.io.File;
22  import java.io.IOException;
23  import java.util.List;
24  
25  import org.apache.maven.archetype.catalog.Archetype;
26  import org.apache.maven.archetype.catalog.ArchetypeCatalog;
27  import org.apache.maven.artifact.DependencyResolutionRequiredException;
28  import org.eclipse.aether.RepositorySystemSession;
29  import org.eclipse.aether.repository.RemoteRepository;
30  
31  /** @author Jason van Zyl */
32  public interface ArchetypeManager {
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 repositorySession
66       * @return the catalog.
67       */
68      ArchetypeCatalog getLocalCatalog(RepositorySystemSession repositorySession);
69  
70      /**
71       * Gives the catalog of archetypes located at
72       * <code>https://repo.maven.apache.org/maven2/archetype-catalog.xml</code>.
73       *
74       * @param repositorySession
75       * @param remoteRepositories
76       * @return the catalog.
77       */
78      ArchetypeCatalog getRemoteCatalog(
79              RepositorySystemSession repositorySession, List<RemoteRepository> remoteRepositories);
80  
81      /**
82       * Creates a jar file for an archetype.
83       *
84       * @param archetypeDirectory
85       * @param outputDirectory
86       * @param finalName
87       * @return The File to the generated jar
88       * @throws org.apache.maven.artifact.DependencyResolutionRequiredException
89       * @throws java.io.IOException
90       * @deprecated replaced by archetype plugin's JarMojo using maven-archiver component for Reproducible Builds
91       */
92      @Deprecated
93      File archiveArchetype(File archetypeDirectory, File outputDirectory, String finalName)
94              throws DependencyResolutionRequiredException, IOException;
95  
96      File updateLocalCatalog(RepositorySystemSession repositorySystemSession, Archetype archetype);
97  }