Class ProcessRemoteResourcesMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugin.resources.remote.ProcessRemoteResourcesMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo,org.apache.velocity.runtime.log.LogChute
@Mojo(name="process", defaultPhase=GENERATE_RESOURCES, threadSafe=true) public class ProcessRemoteResourcesMojo extends org.apache.maven.plugin.AbstractMojo implements org.apache.velocity.runtime.log.LogChutePull 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".
-
-
Field Summary
Fields Modifier and Type Field Description protected FilebasedirUsed for calculation of execution-root forrunOnlyAtExecutionRoot.protected org.apache.maven.ProjectDependenciesResolverdependencyResolverprotected StringencodingThe character encoding scheme to be applied when filtering resources.protected StringexcludeArtifactIdsComma separated list of Artifact names too exclude.protected StringexcludeGroupIdsComma separated list of GroupId Names to exclude.protected StringexcludeScopeScope to exclude.protected booleanexcludeTransitiveIf we should exclude transitive dependenciesprotected List<String>filterDelimitersIn cases where a local resource overrides one from a remote resource bundle, that resource should be filtered if the resource set specifies it.protected StringincludeArtifactIdsComma separated list of Artifact names to include.protected StringincludeGroupIdsComma separated list of GroupIds to include.protected booleanincludeProjectPropertiesWhether to include properties defined in the project when filtering resources.protected StringincludeScopeScope to include.protected booleanrunOnlyAtExecutionRootIf true, only generate resources in the directory of the root project in a multimodule build.protected booleanuseDefaultFilterDelimiters
-
Constructor Summary
Constructors Constructor Description ProcessRemoteResourcesMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigureVelocityContext(org.apache.velocity.VelocityContext context)protected booleancopyResourceIfExists(File file, String relFileName, org.apache.velocity.VelocityContext context)voidexecute()protected List<org.apache.maven.project.MavenProject>getProjects()protected Map<org.apache.maven.model.Organization,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)voidinit(org.apache.velocity.runtime.RuntimeServices rs)booleanisLevelEnabled(int level)voidlog(int level, String message)voidlog(int level, String message, Throwable t)protected org.apache.maven.model.ModelmergeModels(org.apache.maven.model.Model parent, org.apache.maven.model.Model child)protected voidprocessResourceBundles(RemoteResourcesClassLoader classLoader, org.apache.velocity.VelocityContext context)protected voidvalidate()
-
-
-
Field Detail
-
filterDelimiters
@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).- Since:
- 1.1
-
useDefaultFilterDelimiters
@Parameter(defaultValue="true") protected boolean useDefaultFilterDelimiters
- Since:
- 1.1
-
runOnlyAtExecutionRoot
@Parameter(defaultValue="false") protected boolean runOnlyAtExecutionRoot
If true, only generate resources in the directory of the root project in a multimodule build. Dependencies from all modules will be aggregated before resource-generation takes place.- Since:
- 1.1
-
basedir
@Parameter(defaultValue="${basedir}", readonly=true, required=true) protected File basedirUsed for calculation of execution-root forrunOnlyAtExecutionRoot.
-
encoding
@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") protected String encodingThe character encoding scheme to be applied when filtering resources.
-
includeProjectProperties
@Parameter(defaultValue="false") protected boolean includeProjectProperties
Whether to include properties defined in the project when filtering resources.- Since:
- 1.2
-
includeScope
@Parameter(property="includeScope", defaultValue="runtime") protected String includeScopeScope to include. An Empty string indicates all scopes (default is "runtime").- Since:
- 1.0
-
excludeScope
@Parameter(property="excludeScope", defaultValue="") protected String excludeScopeScope to exclude. An Empty string indicates no scopes (default).- Since:
- 1.0
-
excludeArtifactIds
@Parameter(property="excludeArtifactIds", defaultValue="") protected String excludeArtifactIdsComma separated list of Artifact names too exclude.- Since:
- 1.0
-
includeArtifactIds
@Parameter(property="includeArtifactIds", defaultValue="") protected String includeArtifactIdsComma separated list of Artifact names to include.- Since:
- 1.0
-
excludeGroupIds
@Parameter(property="excludeGroupIds", defaultValue="") protected String excludeGroupIdsComma separated list of GroupId Names to exclude.- Since:
- 1.0
-
includeGroupIds
@Parameter(property="includeGroupIds", defaultValue="") protected String includeGroupIdsComma 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
-
dependencyResolver
@Component(hint="default") protected org.apache.maven.ProjectDependenciesResolver dependencyResolver
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Specified by:
executein interfaceorg.apache.maven.plugin.Mojo- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getProjects
protected List<org.apache.maven.project.MavenProject> getProjects() throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getProjectsSortedByOrganization
protected Map<org.apache.maven.model.Organization,List<org.apache.maven.project.MavenProject>> getProjectsSortedByOrganization(List<org.apache.maven.project.MavenProject> projects) throws org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoExecutionException
-
copyResourceIfExists
protected boolean copyResourceIfExists(File file, String relFileName, org.apache.velocity.VelocityContext context) 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
-
configureVelocityContext
protected void configureVelocityContext(org.apache.velocity.VelocityContext context) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
processResourceBundles
protected void processResourceBundles(RemoteResourcesClassLoader 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)
-
init
public void init(org.apache.velocity.runtime.RuntimeServices rs) throws Exception- Specified by:
initin interfaceorg.apache.velocity.runtime.log.LogChute- Throws:
Exception
-
log
public void log(int level, String message)- Specified by:
login interfaceorg.apache.velocity.runtime.log.LogChute
-
log
public void log(int level, String message, Throwable t)- Specified by:
login interfaceorg.apache.velocity.runtime.log.LogChute
-
isLevelEnabled
public boolean isLevelEnabled(int level)
- Specified by:
isLevelEnabledin interfaceorg.apache.velocity.runtime.log.LogChute
-
-