@Mojo(name="process", defaultPhase=GENERATE_RESOURCES, threadSafe=true) public class ProcessRemoteResourcesMojo extends AbstractMojo implements org.apache.velocity.runtime.log.LogChute
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".Modifier and Type | Field and Description |
---|---|
protected File |
basedir
Used for calculation of execution-root for
runOnlyAtExecutionRoot . |
protected ProjectDependenciesResolver |
dependencyResolver |
protected String |
encoding
The character encoding scheme to be applied when filtering resources.
|
protected String |
excludeArtifactIds
Comma separated list of Artifact names too exclude.
|
protected String |
excludeGroupIds
Comma separated list of GroupId Names to exclude.
|
protected String |
excludeScope
Scope to exclude.
|
protected boolean |
excludeTransitive
If we should exclude transitive dependencies
|
protected List<String> |
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.
|
protected String |
includeArtifactIds
Comma separated list of Artifact names to include.
|
protected String |
includeGroupIds
Comma separated list of GroupIds to include.
|
protected boolean |
includeProjectProperties
Whether to include properties defined in the project when filtering resources.
|
protected String |
includeScope
Scope to include.
|
protected boolean |
runOnlyAtExecutionRoot
If true, only generate resources in the directory of the root project in a multimodule build.
|
protected boolean |
useDefaultFilterDelimiters |
protected int |
velocityFilterInMemoryThreshold
When the result of velocity transformation fits in memory, it is compared with the actual contents on disk
to eliminate unnecessary destination file overwrite.
|
DEBUG_ID, DEBUG_PREFIX, ERROR_ID, ERROR_PREFIX, INFO_ID, INFO_PREFIX, TRACE_ID, TRACE_PREFIX, WARN_ID, WARN_PREFIX
Constructor and Description |
---|
ProcessRemoteResourcesMojo() |
Modifier and Type | Method and Description |
---|---|
protected VelocityContext |
buildVelocityContext(Map<String,Object> properties) |
protected boolean |
copyResourceIfExists(File file,
String relFileName,
VelocityContext context) |
void |
execute() |
protected List<MavenProject> |
getProjects() |
protected Map<Organization,List<MavenProject>> |
getProjectsSortedByOrganization(List<MavenProject> projects) |
protected Model |
getSupplement(Xpp3Dom supplementModelXml) |
void |
init(RuntimeServices rs) |
boolean |
isLevelEnabled(int level) |
void |
log(int level,
String message) |
void |
log(int level,
String message,
Throwable t) |
protected Model |
mergeModels(Model parent,
Model child) |
protected void |
processResourceBundles(ClassLoader classLoader,
VelocityContext context) |
protected void |
validate() |
getLog, getPluginContext, setLog, setPluginContext
@Parameter protected List<String> 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).
@Parameter(defaultValue="true") protected boolean useDefaultFilterDelimiters
@Parameter(defaultValue="false") protected boolean runOnlyAtExecutionRoot
@Parameter(defaultValue="${basedir}", readonly=true, required=true) protected File basedir
runOnlyAtExecutionRoot
.@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") protected String encoding
@Parameter(defaultValue="false") protected boolean includeProjectProperties
@Parameter(defaultValue="5242880") protected int velocityFilterInMemoryThreshold
@Parameter(property="includeScope", defaultValue="runtime") protected String includeScope
@Parameter(property="excludeScope", defaultValue="") protected String excludeScope
@Parameter(property="excludeArtifactIds", defaultValue="") protected String excludeArtifactIds
@Parameter(property="includeArtifactIds", defaultValue="") protected String includeArtifactIds
@Parameter(property="excludeGroupIds", defaultValue="") protected String excludeGroupIds
@Parameter(property="includeGroupIds", defaultValue="") protected String includeGroupIds
@Parameter(property="excludeTransitive", defaultValue="false") protected boolean excludeTransitive
@Component(hint="default") protected ProjectDependenciesResolver dependencyResolver
public void execute() throws MojoExecutionException
execute
in interface Mojo
MojoExecutionException
protected List<MavenProject> getProjects()
protected Map<Organization,List<MavenProject>> getProjectsSortedByOrganization(List<MavenProject> projects)
protected boolean copyResourceIfExists(File file, String relFileName, VelocityContext context) throws IOException, MojoExecutionException
IOException
MojoExecutionException
protected void validate() throws MojoExecutionException
MojoExecutionException
protected VelocityContext buildVelocityContext(Map<String,Object> properties) throws MojoExecutionException
MojoExecutionException
protected void processResourceBundles(ClassLoader classLoader, VelocityContext context) throws MojoExecutionException
MojoExecutionException
protected Model getSupplement(Xpp3Dom supplementModelXml) throws MojoExecutionException
MojoExecutionException
public void init(RuntimeServices rs) throws Exception
init
in interface org.apache.velocity.runtime.log.LogChute
Exception
public void log(int level, String message)
log
in interface org.apache.velocity.runtime.log.LogChute
public void log(int level, String message, Throwable t)
log
in interface org.apache.velocity.runtime.log.LogChute
public boolean isLevelEnabled(int level)
isLevelEnabled
in interface org.apache.velocity.runtime.log.LogChute
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.