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 AbstractDeployMojoInstalls the artifact in the remote repository.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.StringartifactIdArtifactId of the artifact to be deployed.private java.lang.StringclassifierAdd classifier to the artifactprivate java.lang.StringclassifiersA comma separated list of classifiers for each of the extra side artifacts to deploy.private java.lang.StringdescriptionDescription passed to a generated POM file (in case of generatePom=true)private java.lang.StringextensionExtension of the artifact to be deployed.private java.io.FilefileFile to be deployed.private java.lang.StringfilesA comma separated list of files for each of the extra side artifacts to deploy.private booleangeneratePomUpload a POM for this artifact.private java.lang.StringgroupIdGroupId of the artifact to be deployed.private static java.lang.StringILLEGAL_VERSION_CHARSprivate java.io.FilejavadocThe bundled API docs for the artifact.private org.slf4j.Loggerlogprivate java.lang.StringpackagingType of the artifact to be deployed.private java.io.FilepomFileLocation of an existing POM file to be deployed alongside the main artifact, given by the ${file} parameter.private java.lang.StringrepositoryIdServer Id to map on the <id> under <server> section of settings.xml In most cases, this parameter will be required for authentication.private java.lang.StringskipSet this to 'true' to bypass artifact deploy It's not 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 asfalseprivate java.io.FilesourcesThe bundled sources for the artifact.private java.lang.StringtypesA comma separated list of types for each of the extra side artifacts to deploy.private java.lang.StringurlURL where the artifact will be deployed.private java.lang.StringversionVersion of the artifact to be deployed.-
Fields inherited from class org.apache.maven.plugins.deploy.AbstractDeployMojo
repositorySystem, session
-
-
Constructor Summary
Constructors Constructor Description DeployFileMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()private org.apache.maven.model.ModelgenerateModel()Generates a minimal model from the user-supplied artifact information.private java.io.FilegeneratePomFile()Generates a minimal POM from the user-supplied artifact information.(package private) java.lang.StringgetArtifactId()(package private) java.lang.StringgetClassifier()private java.lang.StringgetExtension(java.io.File file)Specialization ofFileUtils.getExtension(String)that honors varioustar.xxxcombinations.(package private) java.io.FilegetFile()(package private) java.lang.StringgetGroupId()private java.io.FilegetLocalRepositoryFile(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact)Gets the path of the specified artifact within the local repository.(package private) java.lang.StringgetPackaging()(package private) java.lang.StringgetVersion()(package private) voidinitProperties()private booleanisValidId(java.lang.String id)Returnstrueif passed in string is "valid Maven ID" (groupId or artifactId).private booleanisValidVersion(java.lang.String version)Returnstrueif passed in string is "valid Maven (simple.private voidprocessModel(org.apache.maven.model.Model model)Process the supplied pomFile to get groupId, artifactId, version, and packaging(package private) org.apache.maven.model.ModelreadModel(java.io.File pomFile)Extract the model from the specified POM file.(package private) voidsetArtifactId(java.lang.String artifactId)(package private) voidsetClassifier(java.lang.String classifier)(package private) voidsetGroupId(java.lang.String groupId)(package private) voidsetPackaging(java.lang.String packaging)(package private) voidsetPomFile(java.io.File pomFile)(package private) voidsetVersion(java.lang.String version)-
Methods inherited from class org.apache.maven.plugins.deploy.AbstractDeployMojo
deploy, failIfOffline, getRemoteRepository, warnIfAffectedPackagingAndMaven
-
-
-
-
Field Detail
-
log
private final org.slf4j.Logger log
-
groupId
@Parameter(property="groupId") private java.lang.String groupId
GroupId of the artifact to be deployed. Retrieved from POM file if specified.
-
artifactId
@Parameter(property="artifactId") private java.lang.String artifactId
ArtifactId of the artifact to be deployed. Retrieved from POM file if specified.
-
version
@Parameter(property="version") private java.lang.String version
Version of the artifact to be deployed. Retrieved from POM file if specified.
-
packaging
@Parameter(property="packaging") private java.lang.String packaging
Type of the artifact to be deployed. Retrieved from the <packaging> 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.
-
extension
@Parameter(property="extension") private java.lang.String extension
Extension of the artifact to be deployed. If set, will override plugin own logic to detect extension. If not set, as Maven expected, packaging determines the artifact extension.- Since:
- 3.1.3
-
description
@Parameter(property="generatePom.description") private java.lang.String description
Description passed to a generated POM file (in case of generatePom=true)
-
file
@Parameter(property="file", required=true) private java.io.File fileFile to be deployed.
-
javadoc
@Parameter(property="javadoc") private java.io.File javadoc
The bundled API docs for the artifact.- Since:
- 2.6
-
sources
@Parameter(property="sources") private java.io.File sources
The bundled sources for the artifact.- Since:
- 2.6
-
repositoryId
@Parameter(property="repositoryId", defaultValue="remote-repository", required=true) private java.lang.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
@Parameter(property="url", required=true) private java.lang.String urlURL where the artifact will be deployed.
ie ( file:///C:/m2-repo or scp://host.com/path/to/repo )
-
pomFile
@Parameter(property="pomFile") private java.io.File 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
@Parameter(property="classifier") private java.lang.String classifier
Add classifier to the artifact
-
types
@Parameter(property="types") private java.lang.String 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 infilesorclassifiers, then an error will be raised.
-
classifiers
@Parameter(property="classifiers") private java.lang.String classifiers
-
files
@Parameter(property="files") private java.lang.String 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 intypesorclassifiers, then an error will be raised.
-
skip
@Parameter(property="maven.deploy.file.skip", defaultValue="false") private java.lang.String skipSet this to 'true' to bypass artifact deploy It's not 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:
- 3.1.0
-
ILLEGAL_VERSION_CHARS
private static final java.lang.String ILLEGAL_VERSION_CHARS
- See Also:
- Constant Field Values
-
-
Method Detail
-
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.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getLocalRepositoryFile
private java.io.File getLocalRepositoryFile(org.eclipse.aether.RepositorySystemSession session, org.eclipse.aether.artifact.Artifact artifact)Gets the path of the specified artifact within the local repository. Note that the returned path need not exist (yet).
-
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(java.io.File pomFile) throws org.apache.maven.plugin.MojoExecutionExceptionExtract 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 or cannot be read.
-
generatePomFile
private java.io.File generatePomFile() throws org.apache.maven.plugin.MojoExecutionExceptionGenerates 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
void setGroupId(java.lang.String groupId)
-
setArtifactId
void setArtifactId(java.lang.String artifactId)
-
setVersion
void setVersion(java.lang.String version)
-
setPackaging
void setPackaging(java.lang.String packaging)
-
setPomFile
void setPomFile(java.io.File pomFile)
-
getGroupId
java.lang.String getGroupId()
-
getArtifactId
java.lang.String getArtifactId()
-
getVersion
java.lang.String getVersion()
-
getPackaging
java.lang.String getPackaging()
-
getFile
java.io.File getFile()
-
getClassifier
java.lang.String getClassifier()
-
setClassifier
void setClassifier(java.lang.String classifier)
-
getExtension
private java.lang.String getExtension(java.io.File file)
Specialization ofFileUtils.getExtension(String)that honors varioustar.xxxcombinations.
-
isValidId
private boolean isValidId(java.lang.String id)
Returnstrueif passed in string is "valid Maven ID" (groupId or artifactId).
-
isValidVersion
private boolean isValidVersion(java.lang.String version)
Returnstrueif passed in string is "valid Maven (simple. non range, expression, etc) version".
-
-