mirror of https://github.com/apache/maven.git
[MNG-7263] refactor lifecycle providers to ease documentation
- lifecycle id - phases - default plugins bindings
This commit is contained in:
parent
b4773576a8
commit
e5b0831c10
|
@ -31,27 +31,34 @@ import javax.inject.Singleton;
|
|||
import org.apache.maven.lifecycle.Lifecycle;
|
||||
import org.apache.maven.lifecycle.mapping.LifecyclePhase;
|
||||
|
||||
/**
|
||||
* {@code clean} lifecycle provider.
|
||||
*/
|
||||
@Named( "clean" )
|
||||
@Singleton
|
||||
public final class CleanLifecycleProvider
|
||||
implements Provider<Lifecycle>
|
||||
{
|
||||
private static final String LIFECYCLE_ID = "clean";
|
||||
|
||||
private static final String[] PHASES = {
|
||||
"pre-clean",
|
||||
"clean",
|
||||
"post-clean"
|
||||
};
|
||||
|
||||
private final Lifecycle lifecycle;
|
||||
|
||||
@Inject
|
||||
public CleanLifecycleProvider()
|
||||
{
|
||||
HashMap<String, LifecyclePhase> phases = new HashMap<>();
|
||||
phases.put( "clean", new LifecyclePhase( "org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean" ) );
|
||||
HashMap<String, LifecyclePhase> defaultBindings = new HashMap<>();
|
||||
defaultBindings.put( "clean", new LifecyclePhase( "org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean" ) );
|
||||
|
||||
this.lifecycle = new Lifecycle(
|
||||
"clean",
|
||||
Collections.unmodifiableList( Arrays.asList(
|
||||
"pre-clean",
|
||||
"clean",
|
||||
"post-clean"
|
||||
) ),
|
||||
Collections.unmodifiableMap( phases )
|
||||
LIFECYCLE_ID,
|
||||
Collections.unmodifiableList( Arrays.asList( PHASES ) ),
|
||||
Collections.unmodifiableMap( defaultBindings )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,44 +29,51 @@ import javax.inject.Singleton;
|
|||
|
||||
import org.apache.maven.lifecycle.Lifecycle;
|
||||
|
||||
/**
|
||||
* {@code default} lifecycle provider.
|
||||
*/
|
||||
@Named( "default" )
|
||||
@Singleton
|
||||
public final class DefaultLifecycleProvider
|
||||
implements Provider<Lifecycle>
|
||||
{
|
||||
private static final String LIFECYCLE_ID = "default";
|
||||
|
||||
private static final String[] PHASES = {
|
||||
"validate",
|
||||
"initialize",
|
||||
"generate-sources",
|
||||
"process-sources",
|
||||
"generate-resources",
|
||||
"process-resources",
|
||||
"compile",
|
||||
"process-classes",
|
||||
"generate-test-sources",
|
||||
"process-test-sources",
|
||||
"generate-test-resources",
|
||||
"process-test-resources",
|
||||
"test-compile",
|
||||
"process-test-classes",
|
||||
"test",
|
||||
"prepare-package",
|
||||
"package",
|
||||
"pre-integration-test",
|
||||
"integration-test",
|
||||
"post-integration-test",
|
||||
"verify",
|
||||
"install",
|
||||
"deploy"
|
||||
};
|
||||
|
||||
private final Lifecycle lifecycle;
|
||||
|
||||
@Inject
|
||||
public DefaultLifecycleProvider()
|
||||
{
|
||||
this.lifecycle = new Lifecycle(
|
||||
"default",
|
||||
Collections.unmodifiableList( Arrays.asList(
|
||||
"validate",
|
||||
"initialize",
|
||||
"generate-sources",
|
||||
"process-sources",
|
||||
"generate-resources",
|
||||
"process-resources",
|
||||
"compile",
|
||||
"process-classes",
|
||||
"generate-test-sources",
|
||||
"process-test-sources",
|
||||
"generate-test-resources",
|
||||
"process-test-resources",
|
||||
"test-compile",
|
||||
"process-test-classes",
|
||||
"test",
|
||||
"prepare-package",
|
||||
"package",
|
||||
"pre-integration-test",
|
||||
"integration-test",
|
||||
"post-integration-test",
|
||||
"verify",
|
||||
"install",
|
||||
"deploy"
|
||||
) ),
|
||||
null
|
||||
LIFECYCLE_ID,
|
||||
Collections.unmodifiableList( Arrays.asList( PHASES ) ),
|
||||
null // no global plugin bindings for default lifecycle: they are defined per-packaging in separate providers
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,29 +31,36 @@ import javax.inject.Singleton;
|
|||
import org.apache.maven.lifecycle.Lifecycle;
|
||||
import org.apache.maven.lifecycle.mapping.LifecyclePhase;
|
||||
|
||||
/**
|
||||
* {@code site} lifecycle provider.
|
||||
*/
|
||||
@Named( "site" )
|
||||
@Singleton
|
||||
public final class SiteLifecycleProvider
|
||||
implements Provider<Lifecycle>
|
||||
{
|
||||
private static final String LIFECYCLE_ID = "site";
|
||||
|
||||
private static final String[] PHASES = {
|
||||
"pre-site",
|
||||
"site",
|
||||
"post-site",
|
||||
"site-deploy"
|
||||
};
|
||||
|
||||
private final Lifecycle lifecycle;
|
||||
|
||||
@Inject
|
||||
public SiteLifecycleProvider()
|
||||
{
|
||||
HashMap<String, LifecyclePhase> phases = new HashMap<>();
|
||||
phases.put( "site", new LifecyclePhase( "org.apache.maven.plugins:maven-site-plugin:3.9.1:site" ) );
|
||||
phases.put( "site-deploy", new LifecyclePhase( "org.apache.maven.plugins:maven-site-plugin:3.9.1:deploy" ) );
|
||||
HashMap<String, LifecyclePhase> defaultBindings = new HashMap<>();
|
||||
defaultBindings.put( "site", new LifecyclePhase( "org.apache.maven.plugins:maven-site-plugin:3.9.1:site" ) );
|
||||
defaultBindings.put( "site-deploy", new LifecyclePhase( "org.apache.maven.plugins:maven-site-plugin:3.9.1:deploy" ) );
|
||||
|
||||
this.lifecycle = new Lifecycle(
|
||||
"site",
|
||||
Collections.unmodifiableList( Arrays.asList(
|
||||
"pre-site",
|
||||
"site",
|
||||
"post-site",
|
||||
"site-deploy"
|
||||
) ),
|
||||
Collections.unmodifiableMap( phases )
|
||||
LIFECYCLE_ID,
|
||||
Collections.unmodifiableList( Arrays.asList( PHASES ) ),
|
||||
Collections.unmodifiableMap( defaultBindings )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.lifecycle.providers;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
@ -30,23 +31,33 @@ import javax.inject.Singleton;
|
|||
import org.apache.maven.lifecycle.Lifecycle;
|
||||
import org.apache.maven.lifecycle.mapping.LifecyclePhase;
|
||||
|
||||
/**
|
||||
* {@code wrapper} lifecycle provider.
|
||||
*/
|
||||
@Named( "wrapper" )
|
||||
@Singleton
|
||||
public final class WrapperLifecycleProvider
|
||||
implements Provider<Lifecycle>
|
||||
{
|
||||
private static final String LIFECYCLE_ID = "wrapper";
|
||||
|
||||
private static final String[] PHASES =
|
||||
{
|
||||
"wrapper"
|
||||
};
|
||||
|
||||
private final Lifecycle lifecycle;
|
||||
|
||||
@Inject
|
||||
public WrapperLifecycleProvider()
|
||||
{
|
||||
HashMap<String, LifecyclePhase> phases = new HashMap<>();
|
||||
phases.put( "wrapper", new LifecyclePhase( "org.apache.maven.plugins:maven-wrapper-plugin:3.1.0:wrapper" ) );
|
||||
HashMap<String, LifecyclePhase> defaultBindings = new HashMap<>();
|
||||
defaultBindings.put( "wrapper", new LifecyclePhase( "org.apache.maven.plugins:maven-wrapper-plugin:3.1.0:wrapper" ) );
|
||||
|
||||
this.lifecycle = new Lifecycle(
|
||||
"wrapper",
|
||||
Collections.singletonList( "wrapper" ),
|
||||
Collections.unmodifiableMap( phases )
|
||||
LIFECYCLE_ID,
|
||||
Collections.unmodifiableList( Arrays.asList( PHASES ) ),
|
||||
Collections.unmodifiableMap( defaultBindings )
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue