Class AbstractProcessRemoteResourcesMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
AggregateProcessRemoteResourcesMojo,ProcessRemoteResourcesMojo
Pull down resourceBundles containing remote resources and process the resources contained inside. When that is done, the resources are injected into the current (in-memory) Maven project, making them available to the process-resources phase.
Resources that end in ".vm" are treated as Velocity templates. For those, the ".vm" is stripped off for the final artifact name and it's fed through Velocity to have properties expanded, conditions processed, etc...
Resources that don't end in ".vm" are copied "as is".This is a support abstract class, with two non-aggregating and aggregating implementations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe character encoding scheme to be applied when filtering resources.protected StringComma separated list of Artifact names to exclude.protected StringComma separated list of GroupId Names to exclude.protected StringScope to exclude.protected booleanIf we should exclude transitive dependenciesIn cases where a local resource overrides one from a remote resource bundle, that resource should be filtered if the resource set specifies it.protected StringComma separated list of Artifact names to include.protected StringComma separated list of GroupIds to include.protected booleanDeprecated.protected StringScope to include.protected org.apache.maven.execution.MavenSessionThe Maven session.protected org.apache.maven.project.MavenProjectThe current project.Additional properties to be passed to Velocity.protected final org.eclipse.aether.RepositorySystemprotected String[]When resolving project dependencies, specify the scopes to include.protected booleanprotected intDeprecated.not used anymoreFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractProcessRemoteResourcesMojo(org.eclipse.aether.RepositorySystem repoSystem, org.apache.maven.shared.filtering.MavenFileFilter fileFilter, org.codehaus.plexus.resource.ResourceManager locator, org.apache.maven.project.ProjectBuilder projectBuilder, org.apache.maven.artifact.handler.manager.ArtifactHandlerManager artifactHandlerManager) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.velocity.VelocityContextprotected booleancopyResourceIfExists(File outputFile, String bundleResourceName, org.apache.velocity.VelocityContext context, String encoding) voidexecute()protected abstract Set<org.apache.maven.artifact.Artifact> Returns all the transitive hull of all the involved maven projects.protected abstract Set<org.apache.maven.artifact.Artifact> Returns all the direct dependencies of all the involved maven projects.protected List<org.apache.maven.project.MavenProject> getProjectsSortedByOrganization(List<org.apache.maven.project.MavenProject> projects) protected org.apache.maven.model.ModelgetSupplement(org.codehaus.plexus.util.xml.Xpp3Dom supplementModelXml) protected org.apache.maven.model.ModelmergeModels(org.apache.maven.model.Model parent, org.apache.maven.model.Model child) protected voidprocessResourceBundles(ClassLoader classLoader, org.apache.velocity.VelocityContext context) protected voidvalidate()Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
filterDelimiters
In cases where a local resource overrides one from a remote resource bundle, that resource should be filtered if the resource set specifies it. In those cases, this parameter defines the list of delimiters for filterable expressions. These delimiters are specified in the form 'beginToken*endToken'. If no '*' is given, the delimiter is assumed to be the same for start and end.
So, the default filtering delimiters might be specified as:
<delimiters> <delimiter>${*}</delimiter> <delimiter>@</delimiter> </delimiters>Since the '@' delimiter is the same on both ends, we don't need to specify '@*@' (though we can).- Since:
- 1.1
-
useDefaultFilterDelimiters
@Parameter(defaultValue="true") protected boolean useDefaultFilterDelimiters- Since:
- 1.1
-
encoding
@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") protected String encodingThe character encoding scheme to be applied when filtering resources. -
properties
Additional properties to be passed to Velocity. Several properties are automatically added:project- the current MavenProjectprojects- the list of dependency projectsprojectsSortedByOrganization- the list of dependency projects sorted by organizationprojectTimespan- the timespan of the current project (requires inceptionYear in pom)locator- the ResourceManager that can be used to retrieve additional resources
-
includeProjectProperties
Deprecated.as Maven Project is available in Velocity context we can simply use$project.properties.propertyNameWhether to include properties defined in the project when filtering resources.- Since:
- 1.2
-
velocityFilterInMemoryThreshold
Deprecated.not used anymoreWhen the result of velocity transformation fits in memory, it is compared with the actual contents on disk to eliminate unnecessary destination file overwrite. This improves build times since further build steps typically rely on the modification date.- Since:
- 1.6
-
mavenSession
@Parameter(defaultValue="${session}", readonly=true, required=true) protected org.apache.maven.execution.MavenSession mavenSessionThe Maven session. -
project
@Parameter(defaultValue="${project}", readonly=true, required=true) protected org.apache.maven.project.MavenProject projectThe current project. -
includeScope
Scope to include. An Empty string indicates all scopes (default is "runtime").- Since:
- 1.0
-
excludeScope
Scope to exclude. An Empty string indicates no scopes (default).- Since:
- 1.0
-
resolveScopes
When resolving project dependencies, specify the scopes to include. The default is the same as "includeScope" if there are no exclude scopes set. Otherwise, it defaults to "test" to grab all the dependencies so the exclude filters can filter out what is not needed.- Since:
- 1.5
-
excludeArtifactIds
Comma separated list of Artifact names to exclude.- Since:
- 1.0
-
includeArtifactIds
Comma separated list of Artifact names to include.- Since:
- 1.0
-
excludeGroupIds
Comma separated list of GroupId Names to exclude.- Since:
- 1.0
-
includeGroupIds
Comma separated list of GroupIds to include.- Since:
- 1.0
-
excludeTransitive
@Parameter(property="excludeTransitive", defaultValue="false") protected boolean excludeTransitiveIf we should exclude transitive dependencies- Since:
- 1.0
-
repoSystem
protected final org.eclipse.aether.RepositorySystem repoSystem
-
-
Constructor Details
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getProjects
-
getAllDependencies
Returns all the transitive hull of all the involved maven projects. -
getDirectDependencies
Returns all the direct dependencies of all the involved maven projects. -
getProjectsSortedByOrganization
-
copyResourceIfExists
protected boolean copyResourceIfExists(File outputFile, String bundleResourceName, org.apache.velocity.VelocityContext context, String encoding) throws IOException, org.apache.maven.plugin.MojoExecutionException - Throws:
IOExceptionorg.apache.maven.plugin.MojoExecutionException
-
validate
protected void validate() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
buildVelocityContext
protected org.apache.velocity.VelocityContext buildVelocityContext() -
processResourceBundles
protected void processResourceBundles(ClassLoader classLoader, org.apache.velocity.VelocityContext context) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
getSupplement
protected org.apache.maven.model.Model getSupplement(org.codehaus.plexus.util.xml.Xpp3Dom supplementModelXml) throws org.apache.maven.plugin.MojoExecutionException - Throws:
org.apache.maven.plugin.MojoExecutionException
-
mergeModels
protected org.apache.maven.model.Model mergeModels(org.apache.maven.model.Model parent, org.apache.maven.model.Model child)
-
$project.properties.propertyName