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 StringArtifactId of the artifact to be deployed.private StringAdd classifier to the artifactprivate StringA comma separated list of classifiers for each of the extra side artifacts to deploy.private StringDescription passed to a generated POM file (in case of generatePom=true)private StringExtension of the artifact to be deployed.private FileFile to be deployed.private StringA comma separated list of files for each of the extra side artifacts to deploy.private booleanUpload a POM for this artifact.private StringGroupId of the artifact to be deployed.private static final Stringprivate FileThe bundled API docs for the artifact.private final org.slf4j.Loggerprivate StringType of the artifact to be deployed.private FileLocation of an existing POM file to be deployed alongside the main artifact, given by the ${file} parameter.private StringServer Id to map on the <id> under <server> section of settings.xml In most cases, this parameter will be required for authentication.private StringSet 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 FileThe bundled sources for the artifact.private StringA comma separated list of types for each of the extra side artifacts to deploy.private StringURL where the artifact will be deployed.private StringVersion of the artifact to be deployed.Fields inherited from class AbstractDeployMojo
repositorySystem, sessionFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()private org.apache.maven.model.ModelGenerates a minimal model from the user-supplied artifact information.private FileGenerates a minimal POM from the user-supplied artifact information.(package private) String(package private) Stringprivate StringgetExtension(File file) Specialization ofFileUtils.getExtension(String)that honors varioustar.xxxcombinations.(package private) FilegetFile()(package private) Stringprivate 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) String(package private) String(package private) voidprivate booleanReturnstrueif passed in string is "valid Maven ID" (groupId or artifactId).private booleanisValidVersion(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.ModelExtract the model from the specified POM file.(package private) voidsetArtifactId(String artifactId) (package private) voidsetClassifier(String classifier) (package private) voidsetGroupId(String groupId) (package private) voidsetPackaging(String packaging) (package private) voidsetPomFile(File pomFile) (package private) voidsetVersion(String version) Methods inherited from class AbstractDeployMojo
deploy, failIfOffline, getRemoteRepository, warnIfAffectedPackagingAndMavenMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
log
private final org.slf4j.Logger log -
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. -
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
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 -
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
-
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
Set 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
- See Also:
-
-
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.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
getLocalRepositoryFile
private 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(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 or 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
-
getExtension
-
isValidId
Returnstrueif passed in string is "valid Maven ID" (groupId or artifactId). -
isValidVersion
Returnstrueif passed in string is "valid Maven (simple. non range, expression, etc) version".
-