Class CreateProjectFromArchetypeMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
@Mojo(name="generate",
requiresProject=false)
@Execute(phase=GENERATE_SOURCES)
public class CreateProjectFromArchetypeMojo
extends org.apache.maven.plugin.AbstractMojo
implements org.apache.maven.plugin.ContextEnabled
Generates a new project from an archetype, or updates the actual project if using a partial archetype.
If the project is fully generated, it is generated in a directory corresponding to its artifactId.
If the project is updated with a partial archetype, it is done in the current directory.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe archetype's artifactId.private StringThe archetype catalogs to use to build a list and let the user choose from.private StringThe archetype's groupId.private StringThe archetype's version.private BooleanIf set totruewill ask for values also for properties having defaults in the first place.private ArchetypeGenerationConfiguratorprivate StringApplying some filter on displayed archetypes list: format isartifactIdorgroupId:artifactId.private StringGoals to immediately run on the project created from the archetype.private BooleanUser settings used to check the interactiveMode.private org.apache.maven.shared.invoker.Invokerprivate ArchetypeManagerprivate Fileprivate org.apache.maven.project.MavenProjectprivate org.eclipse.aether.RepositorySystemprivate ArchetypeSelectorprivate org.apache.maven.execution.MavenSessionFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
ConstructorsConstructorDescriptionCreateProjectFromArchetypeMojo(ArchetypeManager manager, ArchetypeSelector selector, ArchetypeGenerationConfigurator configurator, org.apache.maven.shared.invoker.Invoker invoker, org.eclipse.aether.RepositorySystem repositorySystem) -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()private voidinvokePostArchetypeGenerationGoals(String goals, String artifactId) Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.ContextEnabled
getPluginContext, setPluginContext
-
Field Details
-
manager
-
selector
-
configurator
-
invoker
private org.apache.maven.shared.invoker.Invoker invoker -
repositorySystem
private org.eclipse.aether.RepositorySystem repositorySystem -
archetypeArtifactId
The archetype's artifactId. -
archetypeGroupId
The archetype's groupId. -
archetypeVersion
The archetype's version. -
archetypeCatalog
@Parameter(property="archetypeCatalog", defaultValue="remote,local") private String archetypeCatalogThe archetype catalogs to use to build a list and let the user choose from. It is a comma-separated list of one or more of the following catalog schemeslocalwhich is the shortcut to the local repositoryremotewhich is the shortcut for a repository with idarchetype, the Maven Central repository (with idcentral) or the first matching mirror for either of the repository idsarchetypeorcentralinternalwhich is an internal catalog
archetypeand optionally a server section with the same id to yoursettings.xmland use the catalog schemeremote.<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>In order to use that repository only for resolving the catalog (and not for downloading regular Maven dependencies from it) it is recommended to include the repository in a profile which is not active by default. and explicitly select it via-P<profile-id>when this goal is called on the command-line. In case of mirrors for either repositoryarchetypeorcentralthe matching mirror's id is considered for server settings (like authentication). If the repository's catalog file is empty or cannot be retrieved,internalcatalog is transparently used as fallback. -
askForDefaultPropertyValues
@Parameter(property="askForDefaultPropertyValues", defaultValue="false", required=true) private Boolean askForDefaultPropertyValuesIf set totruewill ask for values also for properties having defaults in the first place. Only has an effect ifinteractiveModeis used. -
interactiveMode
@Parameter(property="interactiveMode", defaultValue="${settings.interactiveMode}", required=true) private Boolean interactiveModeUser settings used to check the interactiveMode. -
outputDirectory
-
session
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session -
project
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project -
goals
Goals to immediately run on the project created from the archetype. -
filter
Applying some filter on displayed archetypes list: format isartifactIdorgroupId:artifactId.org.apache:-> displays all archetypes which contain org.apache in groupId:jeeorjee-> displays all archetypes which contain jee in artifactIdorg.apache:jee-> displays all archetypes which contain org.apache in groupId AND jee in artifactId
- Since:
- 2.1
-
-
Constructor Details
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Specified by:
executein interfaceorg.apache.maven.plugin.Mojo- Throws:
org.apache.maven.plugin.MojoExecutionException
-
invokePostArchetypeGenerationGoals
-