Package org.apache.maven.plugins.deploy
Class DeployMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugins.deploy.AbstractDeployMojo
-
- org.apache.maven.plugins.deploy.DeployMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="deploy", defaultPhase=DEPLOY, threadSafe=true) public class DeployMojo extends AbstractDeployMojoDeploys an artifact to remote repository.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDeployMojo.State
-
Field Summary
Fields Modifier and Type Field Description private booleanallowIncompleteProjectsSet this totrueto allow incomplete project processing.private static java.util.regex.PatternALT_LEGACY_REPO_SYNTAX_PATTERNprivate static java.util.regex.PatternALT_REPO_SYNTAX_PATTERNprivate java.lang.StringaltDeploymentRepositorySpecifies an alternative repository to which the project artifacts should be deployed (other than those specified in <distributionManagement>).private java.lang.StringaltReleaseDeploymentRepositoryThe alternative repository to use when the project has a final version.private java.lang.StringaltSnapshotDeploymentRepositoryThe alternative repository to use when the project has a snapshot version.private static java.lang.StringDEPLOY_ALT_DEPLOYMENT_REPOSITORYprivate static java.lang.StringDEPLOY_ALT_RELEASE_DEPLOYMENT_REPOSITORYprivate static java.lang.StringDEPLOY_ALT_SNAPSHOT_DEPLOYMENT_REPOSITORYprivate static java.lang.StringDEPLOY_PROCESSED_MARKERprivate booleandeployAtEndWhether every project should be deployed during its own deploy-phase or at the end of the multimodule build.private org.apache.maven.plugin.descriptor.PluginDescriptorpluginDescriptorprivate org.apache.maven.project.MavenProjectprojectprivate java.util.List<org.apache.maven.project.MavenProject>reactorProjectsprivate java.lang.StringskipSet this to 'true' to bypass artifact deploy Since since 3.0.0-M2 it's not anymore a real boolean as it can have more than 2 values:true: will skip as usualreleases: will skip if current version of the project is a releasesnapshots: will skip if current version of the project is a snapshot any other values will be considered asfalse-
Fields inherited from class org.apache.maven.plugins.deploy.AbstractDeployMojo
repositorySystem, session
-
-
Constructor Summary
Constructors Constructor Description DeployMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanallProjectsMarked(java.util.List<org.apache.maven.project.MavenProject> allProjectsUsingPlugin)private voiddeployAllAtOnce(java.util.List<org.apache.maven.project.MavenProject> allProjectsUsingPlugin)voidexecute()private java.util.List<org.apache.maven.project.MavenProject>getAllProjectsUsingPlugin()(package private) org.eclipse.aether.repository.RemoteRepositorygetDeploymentRepository(org.apache.maven.project.MavenProject project, java.lang.String altSnapshotDeploymentRepository, java.lang.String altReleaseDeploymentRepository, java.lang.String altDeploymentRepository)Visible for testing.private java.lang.StringgetPluginContextValue(java.util.Map<java.lang.String,java.lang.Object> pluginContext, java.lang.String key)private DeployMojo.StategetState(java.util.Map<java.lang.String,java.lang.Object> pluginContext)private booleanhasExecution(org.apache.maven.model.Plugin plugin)private booleanhasState(org.apache.maven.project.MavenProject project)private booleanisFile(java.io.File file)private voidprocessProject(org.apache.maven.project.MavenProject project, org.eclipse.aether.deployment.DeployRequest request)private voidputPluginContextValue(java.lang.String key, java.lang.String value)private voidputState(DeployMojo.State state)-
Methods inherited from class org.apache.maven.plugins.deploy.AbstractDeployMojo
deploy, failIfOffline, getRemoteRepository, warnIfAffectedPackagingAndMaven
-
-
-
-
Field Detail
-
ALT_LEGACY_REPO_SYNTAX_PATTERN
private static final java.util.regex.Pattern ALT_LEGACY_REPO_SYNTAX_PATTERN
-
ALT_REPO_SYNTAX_PATTERN
private static final java.util.regex.Pattern ALT_REPO_SYNTAX_PATTERN
-
project
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
-
reactorProjects
@Parameter(defaultValue="${reactorProjects}", required=true, readonly=true) private java.util.List<org.apache.maven.project.MavenProject> reactorProjects
-
pluginDescriptor
@Parameter(defaultValue="${plugin}", required=true, readonly=true) private org.apache.maven.plugin.descriptor.PluginDescriptor pluginDescriptor
-
deployAtEnd
@Parameter(defaultValue="false", property="deployAtEnd") private boolean deployAtEndWhether every project should be deployed during its own deploy-phase or at the end of the multimodule build. If set totrueand the build fails, none of the reactor projects is deployed.- Since:
- 2.8
-
altDeploymentRepository
@Parameter(property="altDeploymentRepository") private java.lang.String altDeploymentRepository
Specifies an alternative repository to which the project artifacts should be deployed (other than those specified in <distributionManagement>).
Format:id::url- id
- The id can be used to pick up the correct credentials from the settings.xml
- url
- The location of the repository
id::layout::urlwherelayoutcould bedefault(ie. Maven 2) orlegacy(ie. Maven 1), but since 3.0.0 the layout part has been removed because Maven 3 only supports Maven 2 repository layout.
-
altSnapshotDeploymentRepository
@Parameter(property="altSnapshotDeploymentRepository") private java.lang.String altSnapshotDeploymentRepository
The alternative repository to use when the project has a snapshot version. Note: In version 2.x, the format wasid::layout::urlwherelayoutcould bedefault(ie. Maven 2) orlegacy(ie. Maven 1), but since 3.0.0 the layout part has been removed because Maven 3 only supports Maven 2 repository layout.- Since:
- 2.8
- See Also:
altDeploymentRepository
-
altReleaseDeploymentRepository
@Parameter(property="altReleaseDeploymentRepository") private java.lang.String altReleaseDeploymentRepository
The alternative repository to use when the project has a final version. Note: In version 2.x, the format wasid::layout::urlwherelayoutcould bedefault(ie. Maven 2) orlegacy(ie. Maven 1), but since 3.0.0 the layout part has been removed because Maven 3 only supports Maven 2 repository layout.- Since:
- 2.8
- See Also:
altDeploymentRepository
-
skip
@Parameter(property="maven.deploy.skip", defaultValue="false") private java.lang.String skipSet this to 'true' to bypass artifact deploy Since since 3.0.0-M2 it's not anymore a real boolean as it can have more than 2 values:true: will skip as usualreleases: will skip if current version of the project is a releasesnapshots: will skip if current version of the project is a snapshot- any other values will be considered as
false
- Since:
- 2.4
-
allowIncompleteProjects
@Parameter(defaultValue="false", property="allowIncompleteProjects") private boolean allowIncompleteProjectsSet this totrueto allow incomplete project processing. By default, such projects are forbidden and Mojo will fail to process them. Incomplete project is a Maven Project that has any other packaging than "pom" and has no main artifact packaged. In the majority of cases, what user really wants here is a project with "pom" packaging and some classified artifact attached (typical example is some assembly being packaged and attached with classifier).- Since:
- 3.1.1
-
DEPLOY_PROCESSED_MARKER
private static final java.lang.String DEPLOY_PROCESSED_MARKER
-
DEPLOY_ALT_RELEASE_DEPLOYMENT_REPOSITORY
private static final java.lang.String DEPLOY_ALT_RELEASE_DEPLOYMENT_REPOSITORY
-
DEPLOY_ALT_SNAPSHOT_DEPLOYMENT_REPOSITORY
private static final java.lang.String DEPLOY_ALT_SNAPSHOT_DEPLOYMENT_REPOSITORY
-
DEPLOY_ALT_DEPLOYMENT_REPOSITORY
private static final java.lang.String DEPLOY_ALT_DEPLOYMENT_REPOSITORY
-
-
Method Detail
-
putState
private void putState(DeployMojo.State state)
-
putPluginContextValue
private void putPluginContextValue(java.lang.String key, java.lang.String value)
-
getPluginContextValue
private java.lang.String getPluginContextValue(java.util.Map<java.lang.String,java.lang.Object> pluginContext, java.lang.String key)
-
getState
private DeployMojo.State getState(java.util.Map<java.lang.String,java.lang.Object> pluginContext)
-
hasState
private boolean hasState(org.apache.maven.project.MavenProject project)
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
deployAllAtOnce
private void deployAllAtOnce(java.util.List<org.apache.maven.project.MavenProject> allProjectsUsingPlugin) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
allProjectsMarked
private boolean allProjectsMarked(java.util.List<org.apache.maven.project.MavenProject> allProjectsUsingPlugin)
-
getAllProjectsUsingPlugin
private java.util.List<org.apache.maven.project.MavenProject> getAllProjectsUsingPlugin()
-
hasExecution
private boolean hasExecution(org.apache.maven.model.Plugin plugin)
-
processProject
private void processProject(org.apache.maven.project.MavenProject project, org.eclipse.aether.deployment.DeployRequest request) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
isFile
private boolean isFile(java.io.File file)
-
getDeploymentRepository
org.eclipse.aether.repository.RemoteRepository getDeploymentRepository(org.apache.maven.project.MavenProject project, java.lang.String altSnapshotDeploymentRepository, java.lang.String altReleaseDeploymentRepository, java.lang.String altDeploymentRepository) throws org.apache.maven.plugin.MojoExecutionExceptionVisible for testing.- Throws:
org.apache.maven.plugin.MojoExecutionException
-
-