Class RenderDependenciesMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugins.dependency.AbstractDependencyMojo
org.apache.maven.plugins.dependency.fromDependencies.AbstractDependencyFilterMojo
org.apache.maven.plugins.dependency.fromDependencies.RenderDependenciesMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
@Mojo(name="render-dependencies",
requiresDependencyResolution=TEST,
defaultPhase=GENERATE_SOURCES,
threadSafe=true)
public class RenderDependenciesMojo
extends AbstractDependencyFilterMojo
This goal renders dependencies based on a velocity template.
- Since:
- 3.9.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringIf not null or empty it will attach the artifact with this classifier.private StringExtension to use for the attached file if classifier is not null/empty.private StringEncoding to write the rendered template.private FileThe file to write the rendered template string.private final org.apache.maven.project.MavenProjectHelperprivate StringVelocity template to use to render the output file.Fields inherited from class AbstractDependencyFilterMojo
excludeArtifactIds, excludeClassifiers, excludeGroupIds, excludeScope, excludeTransitive, excludeTypes, includeArtifactIds, includeClassifiers, includeGroupIds, includeScope, includeTypes, markersDirectory, overWriteIfNewer, overWriteReleases, overWriteSnapshots, prependGroupId, typeFields inherited from class AbstractDependencyMojo
sessionFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedRenderDependenciesMojo(org.apache.maven.execution.MavenSession session, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.project.MavenProject project, ResolverUtil resolverUtil, org.apache.maven.project.ProjectBuilder projectBuilder, org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager, org.apache.maven.project.MavenProjectHelper projectHelper) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidattachFile(String content) protected voidMain entry into mojo.protected org.apache.maven.shared.artifact.filter.collection.ArtifactsFilterReturn anArtifactsFilterindicating which artifacts must be filtered out.private Pathprivate Comparator<org.apache.maven.artifact.Artifact> Trivial null protection impl for comparing callback.private StringDo render the template.voidsetClassifier(String classifier) voidsetExtension(String extension) voidsetOutputEncoding(String outputEncoding) voidsetOutputFile(File outputFile) voidsetTemplate(String template) private voidStores the specified string into that file.Methods inherited from class AbstractDependencyFilterMojo
filterMarkedDependencies, getDependencySets, getDependencySets, getMarkersDirectory, getResolvedDependencies, getResolverUtil, isPrependGroupId, setMarkersDirectory, setPrependGroupIdMethods inherited from class AbstractDependencyMojo
execute, getProject, isSilent, isSkip, setSilent, setSkipMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
outputEncoding
@Parameter(property="outputEncoding", defaultValue="${project.reporting.outputEncoding}") private String outputEncodingEncoding to write the rendered template.- Since:
- 3.9.0
-
outputFile
The file to write the rendered template string. If undefined, it just prints the classpath as [INFO].- Since:
- 3.9.0
-
classifier
If not null or empty it will attach the artifact with this classifier.- Since:
- 3.9.0
-
extension
Extension to use for the attached file if classifier is not null/empty.- Since:
- 3.9.0
-
template
Velocity template to use to render the output file. It can be inline or a file path.- Since:
- 3.9.0
-
projectHelper
private final org.apache.maven.project.MavenProjectHelper projectHelper
-
-
Constructor Details
-
RenderDependenciesMojo
@Inject protected RenderDependenciesMojo(org.apache.maven.execution.MavenSession session, org.sonatype.plexus.build.incremental.BuildContext buildContext, org.apache.maven.project.MavenProject project, ResolverUtil resolverUtil, org.apache.maven.project.ProjectBuilder projectBuilder, org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager, org.apache.maven.project.MavenProjectHelper projectHelper)
-
-
Method Details
-
doExecute
protected void doExecute() throws org.apache.maven.plugin.MojoExecutionExceptionMain entry into mojo.- Specified by:
doExecutein classAbstractDependencyMojo- Throws:
org.apache.maven.plugin.MojoExecutionException- with a message if an error occurs
-
render
-
getTemplatePath
-
orEmpty
private Comparator<org.apache.maven.artifact.Artifact> orEmpty(Function<org.apache.maven.artifact.Artifact, String> getter) Trivial null protection impl for comparing callback.- Parameters:
getter- nominal getter.- Returns:
- a comparer of getter defaulting on empty if getter value is null.
-
attachFile
- Parameters:
content- the rendered template- Throws:
org.apache.maven.plugin.MojoExecutionException- in case of an error
-
store
-
getMarkedArtifactFilter
protected org.apache.maven.shared.artifact.filter.collection.ArtifactsFilter getMarkedArtifactFilter()Description copied from class:AbstractDependencyFilterMojoReturn anArtifactsFilterindicating which artifacts must be filtered out.- Specified by:
getMarkedArtifactFilterin classAbstractDependencyFilterMojo- Returns:
- an
ArtifactsFilterindicating which artifacts must be filtered out
-
setExtension
-
setOutputEncoding
-
setOutputFile
-
setClassifier
-
setTemplate
-