Hi Oliver,

Thanks for your reply. After trawling through the code following on from your 
pointers, I ended up wondering if I could just inform the build context that 
these particular html resources had changed 
(org.sonatype.plexus.build.incremental.BuildContext). I was hoping that this 
would be enough to cause the files to be re-processed for filtering further 
down in the process-resources phase. Here's the code I ended up with:

  int htmlFilesRefreshed = 0;
  String htmlExtensions = "html,htm";
  Collection<?> htmlFiles = FileUtils.listFiles( resourceHtmlFolder, 
htmlExtensions.split( "," ), true );
  for ( Object htmlFileObject : htmlFiles )
  {
    File htmlFile = (File) htmlFileObject;
    buildContext.refresh( htmlFile );
    ++htmlFilesRefreshed;
  }
  if ( htmlFilesRefreshed > 0 )
  {
    getLog().info( "Dependencies changed. " + htmlFilesRefreshed
       + " html file(s) refreshed to enable new <script> insertions." );
  }

The context is declared as:

  /**
   * @component
   */
  private BuildContext buildContext;

Unfortunately, at least within m2eclipse, the above makes no difference as to 
whether the resources are copied over again in the next phase. Anymore thoughts 
and guidance? Again, all that I'm trying to do is ensure that my html resources 
are copied to the target folder again with filtering applied. Thanks for your 
help.

Kind regards,
Christopher

On 05/11/2010, at 10:12 AM, Olivier Lamy wrote:

> Hi,
> Most of the plugin applying filtering use this [1].
> So you can do this in your mojo. (have a look at the resources plugin
> to see how it works [2])

Reply via email to