Package org.apache.maven.archetype
Class DefaultArchetypeManager
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.apache.maven.archetype.DefaultArchetypeManager
-
- All Implemented Interfaces:
ArchetypeManager
,org.codehaus.plexus.logging.LogEnabled
@Component(role=ArchetypeManager.class) public class DefaultArchetypeManager extends org.codehaus.plexus.logging.AbstractLogEnabled implements ArchetypeManager
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,ArchetypeDataSource>
archetypeSources
private ArchetypeCreator
creator
private ArchetypeGenerator
generator
-
Fields inherited from interface org.apache.maven.archetype.ArchetypeManager
ROLE
-
-
Constructor Summary
Constructors Constructor Description DefaultArchetypeManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.io.File
archiveArchetype(java.io.File archetypeDirectory, java.io.File outputDirectory, java.lang.String finalName)
Creates a jar file for an archetype.ArchetypeCreationResult
createArchetypeFromProject(ArchetypeCreationRequest request)
A command to create an archetype from an existing Maven project given the supplied creation request.ArchetypeGenerationResult
generateProjectFromArchetype(ArchetypeGenerationRequest request)
A command to generate a Maven project from an archetype given the supplied generation request.ArchetypeCatalog
getInternalCatalog()
Gives the catalog of archetypes internal to the plugin.ArchetypeCatalog
getLocalCatalog(org.apache.maven.project.ProjectBuildingRequest buildingRequest)
Gives the catalog of archetypes located in the given path.ArchetypeCatalog
getRemoteCatalog(org.apache.maven.project.ProjectBuildingRequest buildingRequest)
Gives the catalog of archetypes located athttps://repo.maven.apache.org/maven2/archetype-catalog.xml
.java.io.File
updateLocalCatalog(org.apache.maven.project.ProjectBuildingRequest buildingRequest, Archetype archetype)
void
zip(java.io.File sourceDirectory, java.io.File archive)
private void
zipper(java.util.zip.ZipOutputStream zos, int offset, java.io.File currentSourceDirectory)
-
-
-
Field Detail
-
creator
@Requirement(hint="fileset") private ArchetypeCreator creator
-
generator
@Requirement private ArchetypeGenerator generator
-
archetypeSources
@Requirement(role=ArchetypeDataSource.class) private java.util.Map<java.lang.String,ArchetypeDataSource> archetypeSources
-
-
Method Detail
-
createArchetypeFromProject
public ArchetypeCreationResult createArchetypeFromProject(ArchetypeCreationRequest request)
Description copied from interface:ArchetypeManager
A command to create an archetype from an existing Maven project given the supplied creation request.- Specified by:
createArchetypeFromProject
in interfaceArchetypeManager
- Returns:
- The result of creating the archetype from the existing project. It contains any errors that might have occurred.
-
generateProjectFromArchetype
public ArchetypeGenerationResult generateProjectFromArchetype(ArchetypeGenerationRequest request)
Description copied from interface:ArchetypeManager
A command to generate a Maven project from an archetype given the supplied generation request.- Specified by:
generateProjectFromArchetype
in interfaceArchetypeManager
- Returns:
- The result of creating the project from the existing archetype. It contains any errors that might have occurred.
-
archiveArchetype
public java.io.File archiveArchetype(java.io.File archetypeDirectory, java.io.File outputDirectory, java.lang.String finalName) throws org.apache.maven.artifact.DependencyResolutionRequiredException, java.io.IOException
Description copied from interface:ArchetypeManager
Creates a jar file for an archetype.- Specified by:
archiveArchetype
in interfaceArchetypeManager
- Returns:
- The File to the generated jar
- Throws:
org.apache.maven.artifact.DependencyResolutionRequiredException
java.io.IOException
-
zip
public void zip(java.io.File sourceDirectory, java.io.File archive) throws java.io.IOException
- Throws:
java.io.IOException
-
zipper
private void zipper(java.util.zip.ZipOutputStream zos, int offset, java.io.File currentSourceDirectory) throws java.io.IOException
- Throws:
java.io.IOException
-
getInternalCatalog
public ArchetypeCatalog getInternalCatalog()
Description copied from interface:ArchetypeManager
Gives the catalog of archetypes internal to the plugin.- Specified by:
getInternalCatalog
in interfaceArchetypeManager
- Returns:
- the catalog.
-
getLocalCatalog
public ArchetypeCatalog getLocalCatalog(org.apache.maven.project.ProjectBuildingRequest buildingRequest)
Description copied from interface:ArchetypeManager
Gives the catalog of archetypes located in the given path. if path is a file, it used as is. if path is a directory, archetype-catalog.xml is appended to it.- Specified by:
getLocalCatalog
in interfaceArchetypeManager
- Parameters:
buildingRequest
- the catalog file path or directory containing the catalog file.- Returns:
- the catalog.
-
getRemoteCatalog
public ArchetypeCatalog getRemoteCatalog(org.apache.maven.project.ProjectBuildingRequest buildingRequest)
Description copied from interface:ArchetypeManager
Gives the catalog of archetypes located athttps://repo.maven.apache.org/maven2/archetype-catalog.xml
.- Specified by:
getRemoteCatalog
in interfaceArchetypeManager
- Parameters:
buildingRequest
- TODO- Returns:
- the catalog.
-
updateLocalCatalog
public java.io.File updateLocalCatalog(org.apache.maven.project.ProjectBuildingRequest buildingRequest, Archetype archetype)
- Specified by:
updateLocalCatalog
in interfaceArchetypeManager
-
-