public abstract class AbstractHelpMojo extends AbstractMojo
Modifier and Type | Field and Description |
---|---|
protected org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver |
artifactResolver
Component used to resolve artifacts and download their files from remote repositories.
|
protected static int |
LINE_LENGTH
The maximum length of a display line.
|
protected ArtifactRepository |
localRepository
Local Repository.
|
protected static String |
LS
The line separator for the current OS.
|
protected File |
output
Optional parameter to write the output of this help in a given file, instead of writing to the console.
|
protected ProjectBuilder |
projectBuilder
Maven Project Builder component.
|
protected List<ArtifactRepository> |
remoteRepositories
Remote repositories used for the project.
|
protected MavenSession |
session
The current build session instance.
|
Constructor and Description |
---|
AbstractHelpMojo() |
Modifier and Type | Method and Description |
---|---|
protected org.apache.maven.shared.transfer.artifact.ArtifactCoordinate |
getArtifactCoordinate(String artifactString,
String type)
Parses the given String into GAV artifact coordinate information, adding the given type.
|
protected org.apache.maven.shared.transfer.artifact.ArtifactCoordinate |
getArtifactCoordinate(String groupId,
String artifactId,
String version,
String type) |
protected MavenProject |
getMavenProject(String artifactString)
Retrieves the Maven Project associated with the given artifact String, in the form of
groupId:artifactId[:version] . |
protected static void |
writeFile(File output,
String content)
Utility method to write a content in a given file.
|
protected static void |
writeFile(File output,
StringBuilder content)
Utility method to write a content in a given file.
|
getLog, getPluginContext, setLog, setPluginContext
protected static final int LINE_LENGTH
protected static final String LS
@Component protected ProjectBuilder projectBuilder
@Component protected org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver artifactResolver
@Parameter(defaultValue="${project.remoteArtifactRepositories}", required=true, readonly=true) protected List<ArtifactRepository> remoteRepositories
@Parameter(defaultValue="${localRepository}", required=true, readonly=true) protected ArtifactRepository localRepository
@Parameter(defaultValue="${session}", readonly=true, required=true) protected MavenSession session
@Parameter(property="output") protected File output
protected static void writeFile(File output, StringBuilder content) throws IOException
output
- is the wanted output file.content
- contains the content to be written to the file.IOException
- if anywriteFile(File, String)
protected static void writeFile(File output, String content) throws IOException
output
- is the wanted output file.content
- contains the content to be written to the file.IOException
- if anyprotected org.apache.maven.shared.transfer.artifact.ArtifactCoordinate getArtifactCoordinate(String artifactString, String type) throws MojoExecutionException
artifactString
- should respect the format groupId:artifactId[:version]
type
- The extension for the artifact, must not be null
.Artifact
object for the artifactString
parameter.MojoExecutionException
- if the artifactString
doesn't respect the format.protected org.apache.maven.shared.transfer.artifact.ArtifactCoordinate getArtifactCoordinate(String groupId, String artifactId, String version, String type)
protected MavenProject getMavenProject(String artifactString) throws MojoExecutionException
groupId:artifactId[:version]
. This resolves the POM artifact at those coordinates and then builds
the Maven project from it.artifactString
- Coordinates of the Maven project to get.MojoExecutionException
- If there was an error while getting the Maven project.Copyright © 2001–2019 The Apache Software Foundation. All rights reserved.