Package org.apache.maven.plugins.deploy
Class DeployFileMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.deploy.AbstractDeployMojo
org.apache.maven.plugins.deploy.DeployFileMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled
,org.apache.maven.plugin.Mojo
@Mojo(name="deploy-file",
requiresProject=false,
threadSafe=true)
public class DeployFileMojo
extends AbstractDeployMojo
Installs the artifact in the remote repository.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.apache.maven.shared.transfer.artifact.deploy.ArtifactDeployer
private String
ArtifactId of the artifact to be deployed.private String
Add classifier to the artifactprivate String
A comma separated list of classifiers for each of the extra side artifacts to deploy.private String
Description passed to a generated POM file (in case of generatePom=true)private File
File to be deployed.private String
A comma separated list of files for each of the extra side artifacts to deploy.private boolean
Upload a POM for this artifact.private String
GroupId of the artifact to be deployed.private File
The bundled API docs for the artifact.private String
Type of the artifact to be deployed.private File
Location of an existing POM file to be deployed alongside the main artifact, given by the ${file} parameter.private org.apache.maven.project.ProjectBuilder
Used for creating the project to which the artifacts to deploy will be attached.private org.apache.maven.project.MavenProjectHelper
Used for attaching the artifacts to deploy to the project.private org.apache.maven.shared.transfer.repository.RepositoryManager
private String
Server Id to map on the <id> under <server> section of settings.xml In most cases, this parameter will be required for authentication.private File
The bundled sources for the artifact.private String
A comma separated list of types for each of the extra side artifacts to deploy.private Boolean
Deprecated.As of Maven 3, this isn't supported anymore and this parameter is only present to break the build if you use it!private String
URL where the artifact will be deployed.private String
Version of the artifact to be deployed.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.maven.project.MavenProject
Creates a Maven project in-memory from the user-supplied groupId, artifactId and version.void
execute()
private org.apache.maven.model.Model
Generates a minimal model from the user-supplied artifact information.private File
Generates a minimal POM from the user-supplied artifact information.(package private) String
(package private) String
(package private) File
getFile()
(package private) String
private File
Gets the path of the artifact constructed from the supplied groupId, artifactId, version, classifier and packaging within the local repository.(package private) String
(package private) String
(package private) void
private void
processModel
(org.apache.maven.model.Model model) Process the supplied pomFile to get groupId, artifactId, version, and packaging(package private) org.apache.maven.model.Model
Extract the model from the specified POM file.(package private) void
setArtifactId
(String artifactId) (package private) void
setClassifier
(String classifier) (package private) void
setGroupId
(String groupId) (package private) void
setPackaging
(String packaging) (package private) void
setPomFile
(File pomFile) (package private) void
setVersion
(String version) Methods inherited from class org.apache.maven.plugins.deploy.AbstractDeployMojo
createDeploymentArtifactRepository, failIfOffline, getRetryFailedDeploymentCount, getSession, warnIfAffectedPackagingAndMaven
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
artifactDeployer
@Component private org.apache.maven.shared.transfer.artifact.deploy.ArtifactDeployer artifactDeployer -
projectHelper
@Component private org.apache.maven.project.MavenProjectHelper projectHelperUsed for attaching the artifacts to deploy to the project. -
projectBuilder
@Component private org.apache.maven.project.ProjectBuilder projectBuilderUsed for creating the project to which the artifacts to deploy will be attached. -
groupId
GroupId of the artifact to be deployed. Retrieved from POM file if specified. -
artifactId
ArtifactId of the artifact to be deployed. Retrieved from POM file if specified. -
version
Version of the artifact to be deployed. Retrieved from POM file if specified. -
packaging
Type of the artifact to be deployed. Retrieved from the <packaginginvalid input: '>' element of the POM file if a POM file specified. Defaults to the file extension if it is not specified via command line or POM.
Maven uses two terms to refer to this datum: the <packaging> element for the entire POM, and the <type> element in a dependency specification. -
description
Description passed to a generated POM file (in case of generatePom=true) -
file
File to be deployed. -
javadoc
The bundled API docs for the artifact.- Since:
- 2.6
-
sources
The bundled sources for the artifact.- Since:
- 2.6
-
repositoryId
@Parameter(property="repositoryId", defaultValue="remote-repository", required=true) private String repositoryIdServer Id to map on the <id> under <server> section of settings.xml In most cases, this parameter will be required for authentication. -
url
URL where the artifact will be deployed.
ie ( file:///C:/m2-repo or scp://host.com/path/to/repo ) -
pomFile
Location of an existing POM file to be deployed alongside the main artifact, given by the ${file} parameter. -
generatePom
@Parameter(property="generatePom", defaultValue="true") private boolean generatePomUpload a POM for this artifact. Will generate a default POM if none is supplied with the pomFile argument. -
classifier
Add classifier to the artifact -
uniqueVersion
Deprecated.As of Maven 3, this isn't supported anymore and this parameter is only present to break the build if you use it!Whether to deploy snapshots with a unique version or not. -
types
A comma separated list of types for each of the extra side artifacts to deploy. If there is a mis-match in the number of entries infiles
orclassifiers
, then an error will be raised. -
classifiers
-
files
A comma separated list of files for each of the extra side artifacts to deploy. If there is a mis-match in the number of entries intypes
orclassifiers
, then an error will be raised. -
repoManager
@Component private org.apache.maven.shared.transfer.repository.RepositoryManager repoManager
-
-
Constructor Details
-
DeployFileMojo
public DeployFileMojo()
-
-
Method Details
-
initProperties
void initProperties() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
-
createMavenProject
private org.apache.maven.project.MavenProject createMavenProject() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureExceptionCreates a Maven project in-memory from the user-supplied groupId, artifactId and version. When a classifier is supplied, the packaging must be POM because the project with only have attachments. This project serves as basis to attach the artifacts to deploy to.- Returns:
- The created Maven project, never
null
. - Throws:
org.apache.maven.plugin.MojoExecutionException
- When the model of the project could not be built.org.apache.maven.plugin.MojoFailureException
- When building the project failed.
-
getLocalRepoFile
Gets the path of the artifact constructed from the supplied groupId, artifactId, version, classifier and packaging within the local repository. Note that the returned path need not exist (yet).- Returns:
- The absolute path to the artifact when installed, never
null
.
-
processModel
private void processModel(org.apache.maven.model.Model model) Process the supplied pomFile to get groupId, artifactId, version, and packaging- Parameters:
model
- The POM to extract missing artifact coordinates from, must not benull
.
-
readModel
org.apache.maven.model.Model readModel(File pomFile) throws org.apache.maven.plugin.MojoExecutionException Extract the model from the specified POM file.- Parameters:
pomFile
- The path of the POM file to parse, must not benull
.- Returns:
- The model from the POM file, never
null
. - Throws:
org.apache.maven.plugin.MojoExecutionException
- If the file doesn't exist of cannot be read.
-
generatePomFile
Generates a minimal POM from the user-supplied artifact information.- Returns:
- The path to the generated POM file, never
null
. - Throws:
org.apache.maven.plugin.MojoExecutionException
- If the generation failed.
-
generateModel
private org.apache.maven.model.Model generateModel()Generates a minimal model from the user-supplied artifact information.- Returns:
- The generated model, never
null
.
-
setGroupId
-
setArtifactId
-
setVersion
-
setPackaging
-
setPomFile
-
getGroupId
String getGroupId() -
getArtifactId
String getArtifactId() -
getVersion
String getVersion() -
getPackaging
String getPackaging() -
getFile
File getFile() -
getClassifier
String getClassifier() -
setClassifier
-