From 3d2fc8f7eabde64baac943e12887e15c3a6ef990 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Sun, 22 Dec 2024 11:20:39 +0000 Subject: [PATCH] Update custom filters docs (#86) --- .../examples/custom-resource-filters.apt.vm | 42 +++++-------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/src/site/apt/examples/custom-resource-filters.apt.vm b/src/site/apt/examples/custom-resource-filters.apt.vm index 639e74e..b8d533c 100644 --- a/src/site/apt/examples/custom-resource-filters.apt.vm +++ b/src/site/apt/examples/custom-resource-filters.apt.vm @@ -28,48 +28,28 @@ Custom resources filters - With version 2.5 you are now able to build your own custom resources filter(s). - - Your custom resources filter classes must implements + You can build your own custom resources filters. + Custom resource filter classes implement {{{/shared/maven-filtering/apidocs/org/apache/maven/shared/filtering/MavenResourcesFiltering.html}org.apache.maven.shared.filtering.MavenResourcesFiltering}}. * Custom Resources Filter Implementation - Your custom resources filter classes must be marked as a Plexus Component. Below a sample with a roleHint itFilter. +Custom resource filter classes must be marked as a component with +the javax.inject.Named annotation, and are usually also singletons. +Below is an example named "itFilter" +-----+ - -/** - * @plexus.component role="org.apache.maven.shared.filtering.MavenResourcesFiltering" - * role-hint="itFilter" - */ +@Singleton +@Named("itFilter") public class ItFilter implements MavenResourcesFiltering -+-----+ - - Then you must activate in your build the mojo which will scan javadoc annotations to transform thoses to plexus component metadata. - -+-----+ - - - org.codehaus.plexus - plexus-component-metadata - 1.7.1 - - - - generate-metadata - - - - - +-----+ * Dependency declaration - Your classes must be available in the maven-resources-plugin classpath, this can be done with adding your artifact to the plugin dependencies. +Your classes must be available in the maven-resources-plugin classpath. +This can be done by adding your artifact to the plugin dependencies. +-----+ @@ -100,7 +80,7 @@ public class ItFilter * Use of your Custom Resource Filter with the maven-resources-plugin - You must now declare you custom filter in the plugin. mavenFilteringHint must respect same syntax as your Plexus Component roleHint. +You must now declare the custom filter in the plugin. +-----+ @@ -118,4 +98,4 @@ public class ItFilter +-----+ - And that's it ! + And that's it!