@Mojo(name="generate",
requiresProject=false)
@Execute(phase=GENERATE_SOURCES)
public class CreateProjectFromArchetypeMojo
extends org.apache.maven.plugin.AbstractMojo
implements org.apache.maven.plugin.ContextEnabled
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
archetypeArtifactId
The archetype's artifactId.
|
private java.lang.String |
archetypeCatalog
The archetype catalogs to use to build a list and let the user choose from.
|
private java.lang.String |
archetypeGroupId
The archetype's groupId.
|
private java.lang.String |
archetypeRepository
The archetype's repository.
|
private java.lang.String |
archetypeVersion
The archetype's version.
|
private java.io.File |
basedir |
private ArchetypeGenerationConfigurator |
configurator |
private java.lang.String |
filter
Applying some filter on displayed archetypes list: format is
artifactId or groupId:artifactId . |
private java.lang.String |
goals
Additional goals to immediately run on the project created from the archetype.
|
private java.lang.Boolean |
interactiveMode
User settings used to check the interactiveMode.
|
private org.apache.maven.shared.invoker.Invoker |
invoker |
private org.apache.maven.artifact.repository.ArtifactRepository |
localRepository
Local Maven repository.
|
private ArchetypeManager |
manager |
private java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> |
remoteArtifactRepositories
List of remote repositories used by the resolver.
|
private ArchetypeSelector |
selector |
private org.apache.maven.execution.MavenSession |
session |
Constructor and Description |
---|
CreateProjectFromArchetypeMojo() |
Modifier and Type | Method and Description |
---|---|
void |
execute() |
private void |
invokePostArchetypeGenerationGoals(java.lang.String goals,
java.lang.String artifactId) |
getLog, getPluginContext, setLog, setPluginContext
@Component private ArchetypeManager manager
@Component private ArchetypeSelector selector
@Component private ArchetypeGenerationConfigurator configurator
@Component private org.apache.maven.shared.invoker.Invoker invoker
@Parameter(property="archetypeArtifactId") private java.lang.String archetypeArtifactId
@Parameter(property="archetypeGroupId") private java.lang.String archetypeGroupId
@Parameter(property="archetypeVersion") private java.lang.String archetypeVersion
@Parameter(property="archetypeRepository") private java.lang.String archetypeRepository
@Parameter(property="archetypeCatalog", defaultValue="remote,local") private java.lang.String archetypeCatalog
file://...
' with archetype-catalog.xml
automatically appended when pointing to a directoryhttp://...
' or 'https://...
' with archetype-catalog.xml
always appendedlocal
' which is the shortcut for 'file://~/.m2/archetype-catalog.xml
'remote
' which is the shortcut for Maven Central repository, ie 'http://repo.maven.apache.org/maven2
'internal
' which is an internal cataloginternal,local
but remote,local
.
If Maven Central repository catalog file is empty, internal
catalog is used instead.@Parameter(defaultValue="${localRepository}", readonly=true, required=true) private org.apache.maven.artifact.repository.ArtifactRepository localRepository
@Parameter(defaultValue="${project.remoteArtifactRepositories}", readonly=true, required=true) private java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> remoteArtifactRepositories
@Parameter(property="interactiveMode", defaultValue="${settings.interactiveMode}", required=true) private java.lang.Boolean interactiveMode
@Parameter(defaultValue="${basedir}") private java.io.File basedir
@Parameter(defaultValue="${session}", readonly=true) private org.apache.maven.execution.MavenSession session
@Parameter(property="goals") private java.lang.String goals
@Parameter(property="filter") private java.lang.String filter
artifactId
or groupId:artifactId
.
org.apache:
-> displays all archetypes which contain org.apache in groupId:jee
or jee
-> displays all archetypes which contain jee in artifactIdorg.apache:jee
-> displays all archetypes which contain org.apache in groupId AND jee in artifactIdpublic void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
execute
in interface org.apache.maven.plugin.Mojo
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
private void invokePostArchetypeGenerationGoals(java.lang.String goals, java.lang.String artifactId) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException